Skip to content

Incorrect use_self warning #1993

Closed
Closed
@MasonRemaley

Description

@MasonRemaley

I believe I've come across a case where clippy gives a use_self warning but shouldn't:

#![warn(use_self)]

pub trait Foo {
    fn foo() -> Option<()>;
}

impl Foo for Option<i32> {
    fn foo() -> Option<()> { // can't use `Self` here as `Self` is `Option<i32>` not `Option<()>`
        unimplemented!()
    }
}

fn main() {}

(playground link)

It's possible this is actually correct and it just wants me to specify Self with different params in which case I'm just not sure what the syntax is for that.


Potentially related, I'd actually be interested in helping out with Clippy. If this seems like an easy issue to get started on I'd be happy to try to fix it myself!

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thinggood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions