Skip to content

wrong_self_convention false positive? #7032

@leonardo-m

Description

@leonardo-m
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions