Skip to content

Commit

Permalink
Fix clippy::needless_borrowed_reference warning
Browse files Browse the repository at this point in the history
```
warning: dereferencing a tuple pattern where every element takes a reference
    --> crossbeam-skiplist/src/base.rs:1721:30
     |
1721 |             (Some(ref next), &Some(ref t)) if next.key() >= t.key() => {
     |                              ^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
     = note: `#[warn(clippy::needless_borrowed_reference)]` on by default
help: try removing the `&` and `ref` parts
     |
1721 -             (Some(ref next), &Some(ref t)) if next.key() >= t.key() => {
1721 +             (Some(ref next), Some(t)) if next.key() >= t.key() => {
     |

warning: dereferencing a tuple pattern where every element takes a reference
    --> crossbeam-skiplist/src/base.rs:1748:14
     |
1748 |             (&Some(ref h), Some(next)) if h.key() >= next.key() => {
     |              ^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
help: try removing the `&` and `ref` parts
     |
1748 -             (&Some(ref h), Some(next)) if h.key() >= next.key() => {
1748 +             (Some(h), Some(next)) if h.key() >= next.key() => {
     |
```
  • Loading branch information
taiki-e committed Dec 16, 2022
1 parent 374c5cd commit fd0ad9f
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 @@ -1718,7 +1718,7 @@ where
};
match (&next_head, &self.tail) {
// The next key is larger than the latest tail key we observed with this iterator.
(Some(ref next), &Some(ref t)) if next.key() >= t.key() => {
(Some(ref next), Some(t)) if next.key() >= t.key() => {
unsafe {
next.node.decrement(guard);
}
Expand All @@ -1745,7 +1745,7 @@ where
};
match (&self.head, &next_tail) {
// The prev key is smaller than the latest head key we observed with this iterator.
(&Some(ref h), Some(next)) if h.key() >= next.key() => {
(Some(h), Some(next)) if h.key() >= next.key() => {
unsafe {
next.node.decrement(guard);
}
Expand Down

0 comments on commit fd0ad9f

Please sign in to comment.