Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix newly added clippy warnings #941

Merged
merged 2 commits into from
Dec 16, 2022
Merged

Fix newly added clippy warnings #941

merged 2 commits into from
Dec 16, 2022

Conversation

taiki-e
Copy link
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
Member Author

taiki-e commented Dec 16, 2022

bors r+

@bors
Copy link
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