Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRG: fix clippy beta issues #3088

Merged
merged 5 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/core/src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use camino::Utf8PathBuf as PathBuf;
use crate::encodings::Idx;
use crate::manifest::{Manifest, Record};
use crate::prelude::*;
use crate::signature::Signature;
use crate::storage::{FSStorage, InnerStorage, MemStorage, SigStore, Storage, ZipStorage};
use crate::storage::{FSStorage, InnerStorage, MemStorage, SigStore, ZipStorage};
use crate::{Error, Result};

#[cfg(feature = "parallel")]
Expand Down
2 changes: 0 additions & 2 deletions src/core/src/encodings.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::convert::TryFrom;
use std::hash::{BuildHasher, BuildHasherDefault, Hash, Hasher};
use std::iter::Iterator;
use std::str;

use nohash_hasher::BuildNoHashHasher;
Expand Down
3 changes: 1 addition & 2 deletions src/core/src/manifest.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::TryInto;
use std::fs::File;
use std::io::{BufRead, BufReader, Read, Write};
use std::ops::Deref;
Expand All @@ -12,7 +11,7 @@ use serde::{Deserialize, Serialize};

use crate::encodings::HashFunctions;
use crate::prelude::*;
use crate::signature::{Signature, SigsTrait};
use crate::signature::SigsTrait;
use crate::sketch::Sketch;
use crate::Result;

Expand Down
3 changes: 0 additions & 3 deletions src/core/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use core::iter::FusedIterator;

use std::fs::File;
use std::io;
use std::iter::Iterator;
use std::path::Path;
use std::str;

Expand All @@ -18,7 +17,6 @@ use typed_builder::TypedBuilder;

use crate::encodings::{aa_to_dayhoff, aa_to_hp, revcomp, to_aa, HashFunctions, VALID};
use crate::prelude::*;
use crate::selection::{Select, Selection};
use crate::sketch::minhash::KmerMinHash;
use crate::sketch::Sketch;
use crate::Error;
Expand Down Expand Up @@ -891,7 +889,6 @@ impl PartialEq for Signature {

#[cfg(test)]
mod test {
use std::convert::TryInto;
use std::fs::File;
use std::io::{BufReader, Read};
use std::path::PathBuf;
Expand Down
52 changes: 1 addition & 51 deletions src/core/src/sketch/minhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::cmp::Ordering;
use std::collections::{BTreeMap, BTreeSet};
use std::f64::consts::PI;
use std::fmt::Write;
use std::iter::{Iterator, Peekable};
use std::iter::Peekable;
use std::str;
use std::sync::Mutex;

Expand Down Expand Up @@ -942,56 +942,6 @@ impl<T: Ord, I: Iterator<Item = T>> Iterator for Intersection<T, I> {
}
}

struct Union<T, I: Iterator<Item = T>> {
iter: Peekable<I>,
other: Peekable<I>,
}

impl<T: Ord, I: Iterator<Item = T>> Iterator for Union<T, I> {
type Item = T;

fn next(&mut self) -> Option<T> {
let res = match (self.iter.peek(), self.other.peek()) {
(Some(ref left_key), Some(ref right_key)) => left_key.cmp(right_key),
(None, Some(_)) => {
return self.other.next();
}
(Some(_), None) => {
return self.iter.next();
}
_ => return None,
};

match res {
Ordering::Less => self.iter.next(),
Ordering::Greater => self.other.next(),
Ordering::Equal => {
self.other.next();
self.iter.next()
}
}
}
}

#[cfg(test)]
mod test {
use super::Union;

#[test]
fn test_union() {
let v1 = [1u64, 2, 4, 10];
let v2 = [1u64, 3, 4, 9];

let union: Vec<u64> = Union {
iter: v1.iter().peekable(),
other: v2.iter().peekable(),
}
.cloned()
.collect();
assert_eq!(union, [1, 2, 3, 4, 9, 10]);
}
}

//#############
// A MinHash implementation for low scaled or large cardinalities

Expand Down
Loading