From 63c073174a3a477af179d2af5eb8474c43a7515e Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Thu, 9 Jan 2025 16:52:03 +0700 Subject: [PATCH] chore: address clippy lints for Rust 1.85.0-beta Pull-Request: #5802. --- muxers/mplex/src/codec.rs | 12 ++++++------ protocols/kad/src/kbucket/bucket.rs | 4 ++-- protocols/kad/src/query/peers/closest/disjoint.rs | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/muxers/mplex/src/codec.rs b/muxers/mplex/src/codec.rs index a4a04d1964d..20ee6bb4ed6 100644 --- a/muxers/mplex/src/codec.rs +++ b/muxers/mplex/src/codec.rs @@ -299,7 +299,7 @@ impl Encoder for Codec { role: Endpoint::Listener, }, data, - } => (num << 3 | 1, data), + } => ((num << 3) | 1, data), Frame::Data { stream_id: LocalStreamId { @@ -307,35 +307,35 @@ impl Encoder for Codec { role: Endpoint::Dialer, }, data, - } => (num << 3 | 2, data), + } => ((num << 3) | 2, data), Frame::Close { stream_id: LocalStreamId { num, role: Endpoint::Listener, }, - } => (num << 3 | 3, Bytes::new()), + } => ((num << 3) | 3, Bytes::new()), Frame::Close { stream_id: LocalStreamId { num, role: Endpoint::Dialer, }, - } => (num << 3 | 4, Bytes::new()), + } => ((num << 3) | 4, Bytes::new()), Frame::Reset { stream_id: LocalStreamId { num, role: Endpoint::Listener, }, - } => (num << 3 | 5, Bytes::new()), + } => ((num << 3) | 5, Bytes::new()), Frame::Reset { stream_id: LocalStreamId { num, role: Endpoint::Dialer, }, - } => (num << 3 | 6, Bytes::new()), + } => ((num << 3) | 6, Bytes::new()), }; let mut header_buf = encode::u64_buffer(); diff --git a/protocols/kad/src/kbucket/bucket.rs b/protocols/kad/src/kbucket/bucket.rs index 244525238ec..cbc6adf4d5c 100644 --- a/protocols/kad/src/kbucket/bucket.rs +++ b/protocols/kad/src/kbucket/bucket.rs @@ -225,8 +225,8 @@ where // The bucket is full with connected nodes. Drop the pending node. return None; } - debug_assert!(self.first_connected_pos.map_or(true, |p| p > 0)); // (*) - // The pending node will be inserted. + debug_assert!(self.first_connected_pos.is_none_or(|p| p > 0)); // (*) + // The pending node will be inserted. let inserted = pending.node.clone(); // A connected pending node goes at the end of the list for // the connected peers, removing the least-recently connected. diff --git a/protocols/kad/src/query/peers/closest/disjoint.rs b/protocols/kad/src/query/peers/closest/disjoint.rs index 70ded360c7e..a26a31b5215 100644 --- a/protocols/kad/src/query/peers/closest/disjoint.rs +++ b/protocols/kad/src/query/peers/closest/disjoint.rs @@ -552,7 +552,6 @@ mod tests { .flatten() .collect::>() .into_iter() - .map(Key::from) .collect::>(); deduplicated.sort_unstable_by(|a, b| {