You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pubstructFoo;implFoo{#[deny(clippy::unused_self)]pubfnfoo(():()){} # can be any tuple, but it is important to destructure it
pubfnconsume(self){}}
(I denied the lint on the specific item so that I don't have to allow it on the second one, removing which no longer causes the bug)
Running clippy outputs this:
$ cargo clippy
Checking clippy-bug v0.1.0 (/home/snejugal/stuff/clippy-bug)
error: unused `self` argument
--> src/lib.rs:5:16
|
5 | pub fn foo((): ()) {}
| ^^^^^^^
|
note: lint level defined here
--> src/lib.rs:4:12
|
4 | #[deny(clippy::unused_self)]
| ^^^^^^^^^^^^^^^^^^^
= help: consider refactoring to a associated function
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
...
I can reproduce on 1.42 (clippy 0.0.212 (4ee1206 2020-02-01)) and latest nightly (clippy 0.0.212 (23549a8 2020-03-16)). However, it works correctly on 1.41 (clippy 0.0.212 (69f99e7 2019-12-14)).
The text was updated successfully, but these errors were encountered:
unused_self lint was initially meant for impl blocks, recently it was modified to allow on function level and here is where things went wrong. For an impl item for which it is enabled, it takes parent Impl and iterates over all of it's functions, thus enabling lint for one function enables it for all functions in Impl block.
(I denied the lint on the specific item so that I don't have to allow it on the second one, removing which no longer causes the bug)
Running clippy outputs this:
I can reproduce on 1.42 (
clippy 0.0.212 (4ee1206 2020-02-01)
) and latest nightly (clippy 0.0.212 (23549a8 2020-03-16)
). However, it works correctly on 1.41 (clippy 0.0.212 (69f99e7 2019-12-14)
).The text was updated successfully, but these errors were encountered: