-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
☔ 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_self
Closes #4550.