Skip to content

needless_pass_by_value makes no sense for C-like enums #2222

@vthriller

Description

@vthriller
enum Foo { Bar, Baz }

fn f(x: Foo) -> bool {
  match x { 
    Foo::Bar => true,
    Foo::Baz => false,
  }
}

fn main() {
    f(Foo::Bar);
}

Here, Foo can be easily copied (hey, we can even cast it to i32!), so there's no point in referencing and dereferencing it all over the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesgood 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