Skip to content

Commit

Permalink
Fix clippy::assigning_clones warning
Browse files Browse the repository at this point in the history
```
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
```
  • Loading branch information
taiki-e committed May 2, 2024
1 parent 56f90ca commit 9c59813
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crossbeam-skiplist/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,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 {
Expand All @@ -1982,7 +1982,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 {
Expand Down

0 comments on commit 9c59813

Please sign in to comment.