From d1ab07944d42b608390ace90f1b3f1bf672ec1cc Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 3 May 2024 01:36:48 +0900 Subject: [PATCH] Fix clippy::assigning_clones warning ``` warning: assigning the result of `Clone::clone()` may be inefficient --> crossbeam-skiplist/src/base.rs:1958:17 | 1958 | self.head = next_head.clone(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.head.clone_from(&next_head)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones = note: `#[warn(clippy::assigning_clones)]` on by default warning: assigning the result of `Clone::clone()` may be inefficient --> crossbeam-skiplist/src/base.rs:1985:17 | 1985 | self.tail = next_tail.clone(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.tail.clone_from(&next_tail)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones ``` --- crossbeam-skiplist/src/base.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crossbeam-skiplist/src/base.rs b/crossbeam-skiplist/src/base.rs index efa0a1c7f..f8987303c 100644 --- a/crossbeam-skiplist/src/base.rs +++ b/crossbeam-skiplist/src/base.rs @@ -1946,7 +1946,7 @@ where None => self.range.end_bound(), }; if below_upper_bound(&bound, h.key().borrow()) { - self.head = next_head.clone(); + self.head.clone_from(&next_head); next_head } else { unsafe { @@ -1973,7 +1973,7 @@ where None => self.range.start_bound(), }; if above_lower_bound(&bound, t.key().borrow()) { - self.tail = next_tail.clone(); + self.tail.clone_from(&next_tail); next_tail } else { unsafe {