Skip to content

needless_borrow: suggest removing several references at a time. #5327

Closed
@disconnect3d

Description

@disconnect3d

Hey,

It would be nice if Clippy could detect needless references as in here:

fn main() {
    let st = String::from("zomg");
    myfunc(&&&&&st);
}

fn myfunc(param: &str) {
    println!("param: {}", param);
}

The myfunc(&&&&&st); should be myfunc(&st);.

Side note: there is a similar, needless lifetime parameter detecting, that would trigger in e.g. fn myfunc<'a>(param: &'a str)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.L-styleLint: Belongs in the style lint groupL-suggestionLint: Improving, adding or fixing lint suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions