From a19053b10935c1dcbaad05d1809428004effc01b Mon Sep 17 00:00:00 2001 From: alecmocatta Date: Mon, 5 Apr 2021 13:17:46 +0100 Subject: [PATCH] clippy fixes --- amadeus-streaming/src/top.rs | 28 ++++++++++++++-------------- src/pool/thread.rs | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/amadeus-streaming/src/top.rs b/amadeus-streaming/src/top.rs index 41b6bc4f..4a5efa92 100644 --- a/amadeus-streaming/src/top.rs +++ b/amadeus-streaming/src/top.rs @@ -281,38 +281,38 @@ mod test { #[derive(Serialize, Deserialize)] #[serde(bound = "")] - struct HLL(HyperLogLog); - impl Ord for HLL { + struct Hll(HyperLogLog); + impl Ord for Hll { #[inline(always)] fn cmp(&self, other: &Self) -> cmp::Ordering { self.0.len().partial_cmp(&other.0.len()).unwrap() } } - impl PartialOrd for HLL { + impl PartialOrd for Hll { #[inline(always)] fn partial_cmp(&self, other: &Self) -> Option { self.0.len().partial_cmp(&other.0.len()) } } - impl PartialEq for HLL { + impl PartialEq for Hll { #[inline(always)] fn eq(&self, other: &Self) -> bool { self.0.len().eq(&other.0.len()) } } - impl Eq for HLL {} - impl Clone for HLL { + impl Eq for Hll {} + impl Clone for Hll { fn clone(&self) -> Self { Self(self.0.clone()) } } - impl New for HLL { + impl New for Hll { type Config = f64; fn new(config: &Self::Config) -> Self { Self(New::new(config)) } } - impl Intersect for HLL { + impl Intersect for Hll { fn intersect<'a>(iter: impl Iterator) -> Option where Self: Sized + 'a, @@ -320,22 +320,22 @@ mod test { Intersect::intersect(iter.map(|x| &x.0)).map(Self) } } - impl<'a, V: Hash> UnionAssign<&'a HLL> for HLL { + impl<'a, V: Hash> UnionAssign<&'a Hll> for Hll { fn union_assign(&mut self, rhs: &'a Self) { self.0.union_assign(&rhs.0) } } - impl<'a, V: Hash> ops::AddAssign<&'a V> for HLL { + impl<'a, V: Hash> ops::AddAssign<&'a V> for Hll { fn add_assign(&mut self, rhs: &'a V) { self.0.add_assign(rhs) } } - impl Debug for HLL { + impl Debug for Hll { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(fmt) } } - impl IntersectPlusUnionIsPlus for HLL { + impl IntersectPlusUnionIsPlus for Hll { const VAL: bool = as IntersectPlusUnionIsPlus>::VAL; } @@ -344,7 +344,7 @@ mod test { fn top_hll() { let mut rng = rand::rngs::SmallRng::from_seed([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); - let mut top = Top::>::new(1000, 0.99, 2.0 / 1000.0, 0.00408); + let mut top = Top::>::new(1000, 0.99, 2.0 / 1000.0, 0.00408); // let mut x = HashMap::new(); for _ in 0..5_000 { let (a, b) = (rng.gen_range(0, 2) == 0, rng.gen_range(0, 2) == 0); @@ -373,7 +373,7 @@ mod test { let mut rng = rand::rngs::SmallRng::from_seed([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]); - let mut top = Top::>::new(1000, 0.99, 2.0 / 1000.0, 0.05); + let mut top = Top::>::new(1000, 0.99, 2.0 / 1000.0, 0.05); // let mut x = HashMap::new(); for _ in 0..5_000_000 { let (a, b) = (rng.gen_range(0, 2) == 0, rng.gen_range(0, 2) == 0); diff --git a/src/pool/thread.rs b/src/pool/thread.rs index 4f37fdb7..35c388e9 100644 --- a/src/pool/thread.rs +++ b/src/pool/thread.rs @@ -109,7 +109,7 @@ impl ThreadPool { wasm_bindgen_futures::spawn_local(remote); Guard::new(remote_handle.map_ok(|t| { let t: *mut dyn Send = Box::into_raw(t); - *Box::from_raw(t as *mut T) + *Box::from_raw(t.cast::()) })) } }