Skip to content

Commit

Permalink
chore: fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vivienm committed Aug 18, 2024
1 parent 27ceacf commit 0b62b72
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
10 changes: 4 additions & 6 deletions examples/insert_plot.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
collections::hash_map::RandomState,
hash::{BuildHasher, Hash, Hasher},
hash::BuildHasher,
path::{Path, PathBuf},
time::Duration,
};
Expand Down Expand Up @@ -48,9 +48,9 @@ where
.enumerate()
.map(|(i, duration)| (i, duration.as_nanos() as f64)),
0.0,
&RED.mix(0.2),
RED.mix(0.2),
)
.border_style(&RED),
.border_style(RED),
)?;

Ok(())
Expand All @@ -65,9 +65,7 @@ fn main() -> anyhow::Result<()> {
for i in 1..=args.size {
// Compute the hash value manually, to avoid the overhead of hashing in the
// benchmark.
let mut hasher = build_hasher.build_hasher();
i.hash(&mut hasher);
let hash = hasher.finish();
let hash = build_hasher.hash_one(i);

let start = std::time::Instant::now();
bjkst.insert_hash(hash);
Expand Down
10 changes: 5 additions & 5 deletions src/precision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl<'de> serde::Deserialize<'de> for Precision {
D: serde::Deserializer<'de>,
{
let value: u8 = serde::Deserialize::deserialize(deserializer)?;
Ok(Precision::try_from(value).map_err(serde::de::Error::custom)?)
Precision::try_from(value).map_err(serde::de::Error::custom)
}
}

Expand Down Expand Up @@ -407,18 +407,18 @@ mod tests {

#[test]
fn new_get() {
for precision in Precision::variants().iter().copied() {
assert_eq!(precision, Precision::new(precision.get()).unwrap());
for precision in Precision::variants().iter() {
assert_eq!(*precision, Precision::new(precision.get()).unwrap());
}
}

#[test]
fn variants() {
let mut variants: Vec<_> = Precision::variants().iter().copied().collect();
let mut variants: Vec<_> = Precision::variants().iter().collect();
variants.reverse();
for precision_u8 in Precision::MIN.get()..=Precision::MAX.get() {
let precision = Precision::new(precision_u8).unwrap();
assert!(precision == variants.pop().unwrap());
assert!(precision == *variants.pop().unwrap());
}
assert!(variants.is_empty());
}
Expand Down
6 changes: 3 additions & 3 deletions tests/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::assert_eq;
use highway::HighwayBuildHasher;
use uniq_ch::Bjkst;

const SERIALIZED: &'static str = "[4,4,16,0,false,[null,6120665149970903695,null,null,null,null,\
14520555826795478172,793563473396344097,null,null,null,null,\
16707926894801950140,null,null,null]]";
const SERIALIZED: &str = "[4,4,16,0,false,[null,6120665149970903695,null,null,null,null,\
14520555826795478172,793563473396344097,null,null,null,null,\
16707926894801950140,null,null,null]]";

#[test]
fn serialize() {
Expand Down

0 comments on commit 0b62b72

Please sign in to comment.