diff --git a/Cargo.lock b/Cargo.lock index d405464f58f..4093d49504b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2974,7 +2974,7 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.45.0" +version = "0.45.1" dependencies = [ "asynchronous-codec", "bytes", @@ -3476,7 +3476,7 @@ dependencies = [ [[package]] name = "libp2p-webtransport-websys" -version = "0.4.0" +version = "0.4.1" dependencies = [ "futures", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index b631b587dee..dfa32628dbc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -88,7 +88,7 @@ libp2p-mdns = { version = "0.46.0", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.3.1", path = "misc/memory-connection-limits" } libp2p-metrics = { version = "0.15.0", path = "misc/metrics" } libp2p-mplex = { version = "0.42.0", path = "muxers/mplex" } -libp2p-noise = { version = "0.45.0", path = "transports/noise" } +libp2p-noise = { version = "0.45.1", path = "transports/noise" } libp2p-perf = { version = "0.4.0", path = "protocols/perf" } libp2p-ping = { version = "0.45.1", path = "protocols/ping" } libp2p-plaintext = { version = "0.42.0", path = "transports/plaintext" } @@ -111,7 +111,7 @@ libp2p-webrtc-utils = { version = "0.3.0", path = "misc/webrtc-utils" } libp2p-webrtc-websys = { version = "0.4.0-alpha.2", path = "transports/webrtc-websys" } libp2p-websocket = { version = "0.44.1", path = "transports/websocket" } libp2p-websocket-websys = { version = "0.4.1", path = "transports/websocket-websys" } -libp2p-webtransport-websys = { version = "0.4.0", path = "transports/webtransport-websys" } +libp2p-webtransport-websys = { version = "0.4.1", path = "transports/webtransport-websys" } libp2p-yamux = { version = "0.46.0", path = "muxers/yamux" } # External dependencies diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index ddbbc7fb552..0bfee4d3e91 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -18,10 +18,14 @@ - Introduce back pressure and penalize slow peers. Drop stale messages that timeout before being delivered. See [PR 5595](https://github.com/libp2p/rust-libp2p/pull/5595). + - Change `Behaviour::unsubscribe` and `Behaviour::report_message_validation_result` to `bool` they don't need to be a `Result`. See [PR 5595](https://github.com/libp2p/rust-libp2p/pull/5595). +- Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. + See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). + ## 0.47.0 diff --git a/protocols/gossipsub/src/backoff.rs b/protocols/gossipsub/src/backoff.rs index 4414ffb00e6..c955ee59c65 100644 --- a/protocols/gossipsub/src/backoff.rs +++ b/protocols/gossipsub/src/backoff.rs @@ -124,7 +124,7 @@ impl BackoffStorage { pub(crate) fn is_backoff_with_slack(&self, topic: &TopicHash, peer: &PeerId) -> bool { self.backoffs .get(topic) - .map_or(false, |m| m.contains_key(peer)) + .is_some_and(|m| m.contains_key(peer)) } pub(crate) fn get_backoff_time(&self, topic: &TopicHash, peer: &PeerId) -> Option { diff --git a/protocols/gossipsub/src/behaviour.rs b/protocols/gossipsub/src/behaviour.rs index 075a881db48..ae808d97261 100644 --- a/protocols/gossipsub/src/behaviour.rs +++ b/protocols/gossipsub/src/behaviour.rs @@ -1689,7 +1689,7 @@ where let self_published = !self.config.allow_self_origin() && if let Some(own_id) = self.publish_config.get_own_id() { own_id != propagation_source - && raw_message.source.as_ref().map_or(false, |s| s == own_id) + && raw_message.source.as_ref().is_some_and(|s| s == own_id) } else { self.published_message_ids.contains(msg_id) }; diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 55d269bf98f..64049c7b60b 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -6,6 +6,8 @@ See [PR 5573](https://github.com/libp2p/rust-libp2p/pull/5573). - Add `Behavior::find_closest_local_peers()`. See [PR 5645](https://github.com/libp2p/rust-libp2p/pull/5645). +- Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. + See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). ## 0.46.2 diff --git a/protocols/kad/src/jobs.rs b/protocols/kad/src/jobs.rs index 537f652b7a4..fa558878a38 100644 --- a/protocols/kad/src/jobs.rs +++ b/protocols/kad/src/jobs.rs @@ -203,7 +203,7 @@ impl PutRecordJob { T: RecordStore, { if self.inner.check_ready(cx, now) { - let publish = self.next_publish.map_or(false, |t_pub| now >= t_pub); + let publish = self.next_publish.is_some_and(|t_pub| now >= t_pub); let records = store .records() .filter_map(|r| { diff --git a/protocols/kad/src/kbucket.rs b/protocols/kad/src/kbucket.rs index 28d7df03917..99d534fa669 100644 --- a/protocols/kad/src/kbucket.rs +++ b/protocols/kad/src/kbucket.rs @@ -529,12 +529,12 @@ where /// Returns true if the bucket has a pending node. pub fn has_pending(&self) -> bool { - self.bucket.pending().map_or(false, |n| !n.is_ready()) + self.bucket.pending().is_some_and(|n| !n.is_ready()) } /// Tests whether the given distance falls into this bucket. pub fn contains(&self, d: &Distance) -> bool { - BucketIndex::new(d).map_or(false, |i| i == self.index) + BucketIndex::new(d).is_some_and(|i| i == self.index) } /// Generates a random distance that falls into this bucket. diff --git a/protocols/kad/src/kbucket/bucket.rs b/protocols/kad/src/kbucket/bucket.rs index 1426017aa7a..ec2b7756c43 100644 --- a/protocols/kad/src/kbucket/bucket.rs +++ b/protocols/kad/src/kbucket/bucket.rs @@ -377,7 +377,7 @@ where // Adjust `first_connected_pos` accordingly. match status { NodeStatus::Connected => { - if self.first_connected_pos.map_or(false, |p| p == pos.0) + if self.first_connected_pos.is_some_and(|p| p == pos.0) && pos.0 == self.nodes.len() { // It was the last connected node. @@ -398,7 +398,7 @@ where /// Returns the status of the node at the given position. pub(crate) fn status(&self, pos: Position) -> NodeStatus { - if self.first_connected_pos.map_or(false, |i| pos.0 >= i) { + if self.first_connected_pos.is_some_and(|i| pos.0 >= i) { NodeStatus::Connected } else { NodeStatus::Disconnected diff --git a/protocols/kad/src/record.rs b/protocols/kad/src/record.rs index cb7c4b866fc..b8a644acdd6 100644 --- a/protocols/kad/src/record.rs +++ b/protocols/kad/src/record.rs @@ -101,7 +101,7 @@ impl Record { /// Checks whether the record is expired w.r.t. the given `Instant`. pub fn is_expired(&self, now: Instant) -> bool { - self.expires.map_or(false, |t| now >= t) + self.expires.is_some_and(|t| now >= t) } } @@ -154,7 +154,7 @@ impl ProviderRecord { /// Checks whether the provider record is expired w.r.t. the given `Instant`. pub fn is_expired(&self, now: Instant) -> bool { - self.expires.map_or(false, |t| now >= t) + self.expires.is_some_and(|t| now >= t) } } diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index 0109a33747c..69446e62d07 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -5,6 +5,9 @@ - Deprecate `void` crate. See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676). + +- Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. + See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). ## 0.45.1 diff --git a/swarm/src/connection/pool.rs b/swarm/src/connection/pool.rs index b2accf745ef..7964ecbfa69 100644 --- a/swarm/src/connection/pool.rs +++ b/swarm/src/connection/pool.rs @@ -207,7 +207,7 @@ struct PendingConnection { impl PendingConnection { fn is_for_same_remote_as(&self, other: PeerId) -> bool { - self.peer_id.map_or(false, |peer| peer == other) + self.peer_id == Some(other) } /// Aborts the connection attempt, closing the connection. diff --git a/transports/noise/CHANGELOG.md b/transports/noise/CHANGELOG.md index f599ae3533f..cda7132cb28 100644 --- a/transports/noise/CHANGELOG.md +++ b/transports/noise/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.45.1 + +- Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. + See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). + ## 0.45.0 diff --git a/transports/noise/Cargo.toml b/transports/noise/Cargo.toml index 9798ba1836e..8824adcc50c 100644 --- a/transports/noise/Cargo.toml +++ b/transports/noise/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-noise" edition = "2021" rust-version = { workspace = true } description = "Cryptographic handshake protocol using the noise framework." -version = "0.45.0" +version = "0.45.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/transports/noise/src/io/handshake.rs b/transports/noise/src/io/handshake.rs index 8993a5795b6..d8dfb9b802e 100644 --- a/transports/noise/src/io/handshake.rs +++ b/transports/noise/src/io/handshake.rs @@ -106,7 +106,7 @@ where .id_remote_pubkey .ok_or_else(|| Error::AuthenticationFailed)?; - let is_valid_signature = self.dh_remote_pubkey_sig.as_ref().map_or(false, |s| { + let is_valid_signature = self.dh_remote_pubkey_sig.as_ref().is_some_and(|s| { id_pk.verify(&[STATIC_KEY_DOMAIN.as_bytes(), pubkey.as_ref()].concat(), s) }); diff --git a/transports/websocket-websys/CHANGELOG.md b/transports/websocket-websys/CHANGELOG.md index 9d0cb7d7726..affe9ff2551 100644 --- a/transports/websocket-websys/CHANGELOG.md +++ b/transports/websocket-websys/CHANGELOG.md @@ -3,6 +3,9 @@ - fix: Return `None` when extracting a `/dnsaddr` address See [PR 5613](https://github.com/libp2p/rust-libp2p/pull/5613) +- Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. + See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). + ## 0.4.0 - Implement refactored `Transport`. diff --git a/transports/websocket-websys/src/lib.rs b/transports/websocket-websys/src/lib.rs index 17b07c71c0a..21789eeca66 100644 --- a/transports/websocket-websys/src/lib.rs +++ b/transports/websocket-websys/src/lib.rs @@ -20,6 +20,8 @@ //! Libp2p websocket transports built on [web-sys](https://rustwasm.github.io/wasm-bindgen/web-sys/index.html). +#![allow(unexpected_cfgs)] + mod web_context; use bytes::BytesMut; diff --git a/transports/webtransport-websys/CHANGELOG.md b/transports/webtransport-websys/CHANGELOG.md index 411117918bd..45a94495e4e 100644 --- a/transports/webtransport-websys/CHANGELOG.md +++ b/transports/webtransport-websys/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.4.1 + +- Fix `cargo clippy` warnings in `rustc 1.84.0-beta.1`. + See [PR 5700](https://github.com/libp2p/rust-libp2p/pull/5700). + ## 0.4.0 - Implement refactored `Transport`. diff --git a/transports/webtransport-websys/Cargo.toml b/transports/webtransport-websys/Cargo.toml index 0cfc37bf041..ef2865535bf 100644 --- a/transports/webtransport-websys/Cargo.toml +++ b/transports/webtransport-websys/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-webtransport-websys" edition = "2021" rust-version = { workspace = true } description = "WebTransport for libp2p under WASM environment" -version = "0.4.0" +version = "0.4.1" authors = [ "Yiannis Marangos ", "oblique ", diff --git a/transports/webtransport-websys/src/lib.rs b/transports/webtransport-websys/src/lib.rs index f9c59694fa3..dcb1010d986 100644 --- a/transports/webtransport-websys/src/lib.rs +++ b/transports/webtransport-websys/src/lib.rs @@ -1,5 +1,7 @@ //! Libp2p WebTransport built on [web-sys](https://rustwasm.github.io/wasm-bindgen/web-sys/index.html) +#![allow(unexpected_cfgs)] + mod bindings; mod connection; mod endpoint; diff --git a/wasm-tests/webtransport-tests/src/lib.rs b/wasm-tests/webtransport-tests/src/lib.rs index 938cdf0b3e1..4cf4375bf7a 100644 --- a/wasm-tests/webtransport-tests/src/lib.rs +++ b/wasm-tests/webtransport-tests/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(unexpected_cfgs)] + use futures::channel::oneshot; use futures::{AsyncReadExt, AsyncWriteExt}; use getrandom::getrandom;