Add a lint for unused self#4619
Conversation
|
I'd also add a negative test, at least for traits - that we don't lint |
|
There's already a test for the |
|
☔ The latest upstream changes (presumably #4625) made this pull request unmergeable. Please resolve the merge conflicts. |
Sorry, missed it. If you mean this: mod not_applicable {
use std::fmt;
struct A {}
impl fmt::Debug for A {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "A")
}
}
impl A {
fn method(x: u8, y: u8) {}
}
}Then I have a question - does your implementation checks only trait A {
fn method(&self) -> u64 { }
}Will unused |
flip1995
left a comment
There was a problem hiding this comment.
Impl LGTM. Can you remove the file tests/ui/unused_self.stdout?
Also once this lint is pedantic, it should be possible to remove the allows from the unrelated tests.
No, the lint here won't be triggered but I'll add this to the tests. |
|
☔ The latest upstream changes (presumably #4602) made this pull request unmergeable. Please resolve the merge conflicts. |
|
☔ The latest upstream changes (presumably #4560) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Rebased to get rid of the merge commits. Thanks for implementing this lint! @bors r+ |
|
📌 Commit adf5886 has been approved by |
Add a lint for unused self changelog: Adds a new lint: `unused_self` Closes #4550.
|
☀️ Test successful - checks-travis, status-appveyor |
changelog: Adds a new lint:
unused_selfCloses #4550.