Skip to content

Commit b312e54

Browse files
committed
clippy fixes
1 parent 90ce3ab commit b312e54

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

amadeus-core/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
clippy::needless_pass_by_value,
3737
clippy::unnecessary_wraps,
3838
clippy::missing_panics_doc,
39-
clippy::let_underscore_drop
39+
clippy::let_underscore_drop,
40+
clippy::unnested_or_patterns
4041
)]
4142
#![deny(unsafe_code)]
4243

amadeus-core/src/pipe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl<S: ?Sized + Sink<Item> + Unpin, St: ?Sized + Stream<Item = Item> + Unpin, I
306306
let items = &mut **self_.items;
307307
let mut given_all = false;
308308
let stream = stream::poll_fn(|cx| match Pin::new(&mut *items).poll_next(cx) {
309-
x @ (Poll::Ready(Some(_)) | Poll::Pending) => x,
309+
x @ Poll::Ready(Some(_)) | x @ Poll::Pending => x,
310310
Poll::Ready(None) => {
311311
given_all = true;
312312
Poll::Pending

amadeus-streaming/src/top.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -281,61 +281,61 @@ mod test {
281281

282282
#[derive(Serialize, Deserialize)]
283283
#[serde(bound = "")]
284-
struct HLL<V>(HyperLogLog<V>);
285-
impl<V: Hash> Ord for HLL<V> {
284+
struct Hll<V>(HyperLogLog<V>);
285+
impl<V: Hash> Ord for Hll<V> {
286286
#[inline(always)]
287287
fn cmp(&self, other: &Self) -> cmp::Ordering {
288288
self.0.len().partial_cmp(&other.0.len()).unwrap()
289289
}
290290
}
291-
impl<V: Hash> PartialOrd for HLL<V> {
291+
impl<V: Hash> PartialOrd for Hll<V> {
292292
#[inline(always)]
293293
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
294294
self.0.len().partial_cmp(&other.0.len())
295295
}
296296
}
297-
impl<V: Hash> PartialEq for HLL<V> {
297+
impl<V: Hash> PartialEq for Hll<V> {
298298
#[inline(always)]
299299
fn eq(&self, other: &Self) -> bool {
300300
self.0.len().eq(&other.0.len())
301301
}
302302
}
303-
impl<V: Hash> Eq for HLL<V> {}
304-
impl<V: Hash> Clone for HLL<V> {
303+
impl<V: Hash> Eq for Hll<V> {}
304+
impl<V: Hash> Clone for Hll<V> {
305305
fn clone(&self) -> Self {
306306
Self(self.0.clone())
307307
}
308308
}
309-
impl<V: Hash> New for HLL<V> {
309+
impl<V: Hash> New for Hll<V> {
310310
type Config = f64;
311311
fn new(config: &Self::Config) -> Self {
312312
Self(New::new(config))
313313
}
314314
}
315-
impl<V: Hash> Intersect for HLL<V> {
315+
impl<V: Hash> Intersect for Hll<V> {
316316
fn intersect<'a>(iter: impl Iterator<Item = &'a Self>) -> Option<Self>
317317
where
318318
Self: Sized + 'a,
319319
{
320320
Intersect::intersect(iter.map(|x| &x.0)).map(Self)
321321
}
322322
}
323-
impl<'a, V: Hash> UnionAssign<&'a HLL<V>> for HLL<V> {
323+
impl<'a, V: Hash> UnionAssign<&'a Hll<V>> for Hll<V> {
324324
fn union_assign(&mut self, rhs: &'a Self) {
325325
self.0.union_assign(&rhs.0)
326326
}
327327
}
328-
impl<'a, V: Hash> ops::AddAssign<&'a V> for HLL<V> {
328+
impl<'a, V: Hash> ops::AddAssign<&'a V> for Hll<V> {
329329
fn add_assign(&mut self, rhs: &'a V) {
330330
self.0.add_assign(rhs)
331331
}
332332
}
333-
impl<V: Hash> Debug for HLL<V> {
333+
impl<V: Hash> Debug for Hll<V> {
334334
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
335335
self.0.fmt(fmt)
336336
}
337337
}
338-
impl<V> IntersectPlusUnionIsPlus for HLL<V> {
338+
impl<V> IntersectPlusUnionIsPlus for Hll<V> {
339339
const VAL: bool = <HyperLogLog<V> as IntersectPlusUnionIsPlus>::VAL;
340340
}
341341

@@ -344,7 +344,7 @@ mod test {
344344
fn top_hll() {
345345
let mut rng =
346346
rand::rngs::SmallRng::from_seed([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
347-
let mut top = Top::<String, HLL<String>>::new(1000, 0.99, 2.0 / 1000.0, 0.00408);
347+
let mut top = Top::<String, Hll<String>>::new(1000, 0.99, 2.0 / 1000.0, 0.00408);
348348
// let mut x = HashMap::new();
349349
for _ in 0..5_000 {
350350
let (a, b) = (rng.gen_range(0, 2) == 0, rng.gen_range(0, 2) == 0);
@@ -373,7 +373,7 @@ mod test {
373373

374374
let mut rng =
375375
rand::rngs::SmallRng::from_seed([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
376-
let mut top = Top::<String, HLL<String>>::new(1000, 0.99, 2.0 / 1000.0, 0.05);
376+
let mut top = Top::<String, Hll<String>>::new(1000, 0.99, 2.0 / 1000.0, 0.05);
377377
// let mut x = HashMap::new();
378378
for _ in 0..5_000_000 {
379379
let (a, b) = (rng.gen_range(0, 2) == 0, rng.gen_range(0, 2) == 0);

src/pool/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl ThreadPool {
109109
wasm_bindgen_futures::spawn_local(remote);
110110
Guard::new(remote_handle.map_ok(|t| {
111111
let t: *mut dyn Send = Box::into_raw(t);
112-
*Box::from_raw(t as *mut T)
112+
*Box::from_raw(t.cast::<T>())
113113
}))
114114
}
115115
}

0 commit comments

Comments
 (0)