Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed Feb 5, 2024
1 parent 97596f5 commit 3eaf325
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/core/src/sketch/minhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,18 @@ impl KmerMinHash {
None => {
merged.push(*value);
merged.extend(self_iter);
merged_abunds.as_mut().map(|v| v.extend(self_abunds_iter));
if let Some(v) = merged_abunds.as_mut() {
v.extend(self_abunds_iter)
}
break;
}
Some(x) if x < value => {
merged.push(*x);
other_value = other_iter.next();
if let Some(v) = other_abunds_iter.next() {
merged_abunds.as_mut().map(|n| n.push(*v));
if let Some(n) = merged_abunds.as_mut() {
n.push(*v)
}
}
}
Some(x) if x == value => {
Expand All @@ -471,15 +475,19 @@ impl KmerMinHash {

if let (Some(v), Some(s)) = (other_abunds_iter.next(), self_abunds_iter.next())
{
merged_abunds.as_mut().map(|n| n.push(*v + *s));
if let Some(n) = merged_abunds.as_mut() {
n.push(*v + *s)
}
}
}
Some(x) if x > value => {
merged.push(*value);
self_value = self_iter.next();

if let Some(v) = self_abunds_iter.next() {
merged_abunds.as_mut().map(|n| n.push(*v));
if let Some(n) = merged_abunds.as_mut() {
n.push(*v)
}
}
}
Some(_) => {}
Expand All @@ -489,13 +497,15 @@ impl KmerMinHash {
merged.push(*value);
}
merged.extend(other_iter);
merged_abunds.as_mut().map(|n| n.extend(other_abunds_iter));
if let Some(n) = merged_abunds.as_mut() {
n.extend(other_abunds_iter)
}

if merged.len() > (self.num as usize) && (self.num as usize) != 0 {
merged.truncate(self.num as usize);
merged_abunds
.as_mut()
.map(|v| v.truncate(self.num as usize));
if let Some(v) = merged_abunds.as_mut() {

Check warning on line 506 in src/core/src/sketch/minhash.rs

View check run for this annotation

Codecov / codecov/patch

src/core/src/sketch/minhash.rs#L506

Added line #L506 was not covered by tests
v.truncate(self.num as usize)
}
}
self.mins = merged;
self.abunds = merged_abunds;
Expand Down

0 comments on commit 3eaf325

Please sign in to comment.