Skip to content

Fix newly added clippy warnings#941

Merged
bors[bot] merged 2 commits intomasterfrom
clippy
Dec 16, 2022
Merged

Fix newly added clippy warnings#941
bors[bot] merged 2 commits intomasterfrom
clippy

Conversation

@taiki-e
Copy link
Copy Markdown
Member

@taiki-e taiki-e commented Dec 16, 2022

No description provided.

```
warning: boolean to int conversion using if
   --> crossbeam-channel/src/flavors/at.rs:137:9
    |
137 | /         if self.is_empty() {
138 | |             0
139 | |         } else {
140 | |             1
141 | |         }
    | |_________^ help: replace with from: `usize::from(!self.is_empty())`
    |
    = note: `!self.is_empty() as usize` or `(!self.is_empty()).into()` can also be valid options
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if
    = note: `#[warn(clippy::bool_to_int_with_if)]` on by default

warning: boolean to int conversion using if
   --> crossbeam-channel/src/flavors/tick.rs:108:9
    |
108 | /         if self.is_empty() {
109 | |             0
110 | |         } else {
111 | |             1
112 | |         }
    | |_________^ help: replace with from: `usize::from(!self.is_empty())`
    |
    = note: `!self.is_empty() as usize` or `(!self.is_empty()).into()` can also be valid options
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if
```
```
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() => {
     |
```
@taiki-e
Copy link
Copy Markdown
Member Author

taiki-e commented Dec 16, 2022

bors r+

@bors
Copy link
Copy Markdown
Contributor

bors bot commented Dec 16, 2022

Build succeeded:

@bors bors bot merged commit 8903ff0 into master Dec 16, 2022
@bors bors bot deleted the clippy branch December 16, 2022 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant