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 #927

Merged
merged 4 commits into from
Nov 17, 2022
Merged

Fix newly added clippy warnings #927

merged 4 commits into from
Nov 17, 2022

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Nov 17, 2022

error: deref which would be done by auto-deref
   --> crossbeam-utils/src/sync/wait_group.rs:142:29
    |
142 |         let count: &usize = &*self.inner.count.lock().unwrap();
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&self.inner.count.lock().unwrap()`
    |
    = note: `-D clippy::explicit-auto-deref` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

```
error: deref which would be done by auto-deref
   --> crossbeam-utils/src/sync/wait_group.rs:142:29
    |
142 |         let count: &usize = &*self.inner.count.lock().unwrap();
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&self.inner.count.lock().unwrap()`
    |
    = note: `-D clippy::explicit-auto-deref` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
```
@taiki-e
Copy link
Member Author

taiki-e commented Nov 17, 2022

bors r+

bors bot added a commit that referenced this pull request Nov 17, 2022
927: Fix clippy::explicit_auto_deref warning r=taiki-e a=taiki-e

```
error: deref which would be done by auto-deref
   --> crossbeam-utils/src/sync/wait_group.rs:142:29
    |
142 |         let count: &usize = &*self.inner.count.lock().unwrap();
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&self.inner.count.lock().unwrap()`
    |
    = note: `-D clippy::explicit-auto-deref` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
```

Co-authored-by: Taiki Endo <te316e89@gmail.com>
@bors
Copy link
Contributor

bors bot commented Nov 17, 2022

Build failed:

```
error: the borrowed expression implements the required traits
   --> crossbeam-epoch/src/internal.rs:212:17
    |
212 |                 &|sealed_bag: &SealedBag| sealed_bag.is_expired(global_epoch),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `(|sealed_bag: &SealedBag| sealed_bag.is_expired(global_epoch))`
    |
    = note: `-D clippy::needless-borrow` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
```
```
warning: binary comparison to literal `Option::None`
    --> crossbeam-channel/tests/golang.rs:1050:20
     |
1050 |                 if c.recv() != None {
     |                    ^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `c.recv().is_some()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_to_none
     = note: `#[warn(clippy::partialeq_to_none)]` on by default

warning: binary comparison to literal `Option::None`
    --> crossbeam-channel/tests/golang.rs:1053:20
     |
1053 |                 if c.try_recv() != None {
     |                    ^^^^^^^^^^^^^^^^^^^^ help: use `Option::is_some()` instead: `c.try_recv().is_some()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_to_none
```
```
warning: passing a unit value to a function
  --> crossbeam-skiplist/benches/skiplist.rs:97:13
   |
97 |             black_box(map.remove(&num, guard).unwrap().release(guard));
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
   = note: `#[warn(clippy::unit_arg)]` on by default
help: move the expression in front of the call and replace it with the unit literal `()`
   |
97 ~             map.remove(&num, guard).unwrap().release(guard);
98 ~             black_box(());
   |
```
@taiki-e
Copy link
Member Author

taiki-e commented Nov 17, 2022

bors r+

bors bot added a commit that referenced this pull request Nov 17, 2022
927: Fix clippy::explicit_auto_deref warning r=taiki-e a=taiki-e

```
error: deref which would be done by auto-deref
   --> crossbeam-utils/src/sync/wait_group.rs:142:29
    |
142 |         let count: &usize = &*self.inner.count.lock().unwrap();
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `&self.inner.count.lock().unwrap()`
    |
    = note: `-D clippy::explicit-auto-deref` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
```

Co-authored-by: Taiki Endo <te316e89@gmail.com>
@bors
Copy link
Contributor

bors bot commented Nov 17, 2022

Build failed:

@taiki-e taiki-e changed the title Fix clippy::explicit_auto_deref warning Fix newly added clippy warnings Nov 17, 2022
@taiki-e
Copy link
Member Author

taiki-e commented Nov 17, 2022

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 17, 2022

@bors bors bot merged commit c840da4 into master Nov 17, 2022
@bors bors bot deleted the taiki-e/clippy branch November 17, 2022 05:11
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.

None yet

1 participant