From 17d6b4ba67c3343e1ff5004a3f4975faaf9bc034 Mon Sep 17 00:00:00 2001 From: Elena Frank <57632201+elenaf9@users.noreply.github.com> Date: Thu, 18 Nov 2021 13:21:12 +0100 Subject: [PATCH] swarm-derive/lib: Don't clone error on inject_dial_failure (#2349) `NetworkBehaviour::inject_dial_failure` expects a reference for the error, thus the error should not be cloned when passing it to the inner behaviours in the `NetworkBehaviour` derivation. Fixes Issue #2348. --- CHANGELOG.md | 5 +++++ Cargo.toml | 4 ++-- swarm-derive/CHANGELOG.md | 6 ++++++ swarm-derive/Cargo.toml | 2 +- swarm-derive/src/lib.rs | 4 ++-- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index facbdef01e6..c3112024c21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,11 @@ # `libp2p` facade crate +## Version 0.41.1 [unreleased] + +- Update individual crates. + - `libp2p-swarm-derive` + ## Version 0.41.0 [2021-11-16] - Update individual crates. diff --git a/Cargo.toml b/Cargo.toml index a8d93817249..7a013d18843 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p" edition = "2018" description = "Peer-to-peer networking library" -version = "0.41.0" +version = "0.41.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -86,7 +86,7 @@ libp2p-relay = { version = "0.5.0", path = "protocols/relay", optional = true } libp2p-rendezvous = { version = "0.2.0", path = "protocols/rendezvous", optional = true } libp2p-request-response = { version = "0.14.0", path = "protocols/request-response", optional = true } libp2p-swarm = { version = "0.32.0", path = "swarm" } -libp2p-swarm-derive = { version = "0.26.0", path = "swarm-derive" } +libp2p-swarm-derive = { version = "0.26.1", path = "swarm-derive" } libp2p-uds = { version = "0.30.0", path = "transports/uds", optional = true } libp2p-wasm-ext = { version = "0.30.0", path = "transports/wasm-ext", default-features = false, optional = true } libp2p-yamux = { version = "0.34.0", path = "muxers/yamux", optional = true } diff --git a/swarm-derive/CHANGELOG.md b/swarm-derive/CHANGELOG.md index a474845fbc2..18e1eaf717a 100644 --- a/swarm-derive/CHANGELOG.md +++ b/swarm-derive/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.26.1 [unreleased] + +- Remove unnecessary clone of error in `inject_dial_failure` (see [PR 2349]). + +[PR 2349]: https://github.com/libp2p/rust-libp2p/pull/2349 + # 0.26.0 [2021-11-16] - Adjust to advanced dialing requests API changes (see [PR 2317]). diff --git a/swarm-derive/Cargo.toml b/swarm-derive/Cargo.toml index 01ca2087f6d..3c06a853541 100644 --- a/swarm-derive/Cargo.toml +++ b/swarm-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-swarm-derive" edition = "2018" description = "Procedural macros of libp2p-core" -version = "0.26.0" +version = "0.26.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/swarm-derive/src/lib.rs b/swarm-derive/src/lib.rs index 5cab0f131d0..e221a349f38 100644 --- a/swarm-derive/src/lib.rs +++ b/swarm-derive/src/lib.rs @@ -276,10 +276,10 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { let inject = match field.ident { Some(ref i) => { - quote! { self.#i.inject_dial_failure(peer_id, handler, error.clone()) } + quote! { self.#i.inject_dial_failure(peer_id, handler, error) } } None => { - quote! { self.#enum_n.inject_dial_failure(peer_id, handler, error.clone()) } + quote! { self.#enum_n.inject_dial_failure(peer_id, handler, error) } } };