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

wrong_self_convention false positive? #7032

Closed
leonardo-m opened this issue Apr 4, 2021 · 0 comments · Fixed by #7064
Closed

wrong_self_convention false positive? #7032

leonardo-m opened this issue Apr 4, 2021 · 0 comments · Fixed by #7064

Comments

@leonardo-m
Copy link

trait Foo {
    fn from_usize(x: usize) -> Self;
}
impl Foo for usize {
    fn from_usize(x: usize) -> Self { x }
}
fn main() {}

Gives:

warning: methods called `from_*` usually take no `self`
 --> src/main.rs:5:19
  |
5 |     fn from_usize(x: usize) -> Self { x }
  |                   ^
  |
  = note: `#[warn(clippy::wrong_self_convention)]` on by default
  = help: consider choosing a less ambiguous name
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention

But this from_usize isn't taking self.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant