Fix clippy::bool_to_int_with_if warning
``` warning: boolean to int conversion using if --> src/single.rs:93:9 | 93 | / if self.state.load(Ordering::SeqCst) & PUSHED == 0 { 94 | | 0 95 | | } else { 96 | | 1 97 | | } | |_________^ help: replace with from: `usize::from(self.state.load(Ordering::SeqCst) & PUSHED != 0)` | = note: `(self.state.load(Ordering::SeqCst) & PUSHED != 0) as usize` or `(self.state.load(Ordering::SeqCst) & PUSHED != 0).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 ```
This commit is contained in:
parent
d14af85906
commit
6be67b375d
|
@ -90,11 +90,7 @@ impl<T> Single<T> {
|
|||
|
||||
/// Returns the number of items in the queue.
|
||||
pub fn len(&self) -> usize {
|
||||
if self.state.load(Ordering::SeqCst) & PUSHED == 0 {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
usize::from(self.state.load(Ordering::SeqCst) & PUSHED != 0)
|
||||
}
|
||||
|
||||
/// Returns `true` if the queue is empty.
|
||||
|
|
Loading…
Reference in New Issue