Skip to content

Adding feature to "accept" a clippy suggestion #4300

Closed
@Will-Low

Description

@Will-Low

Clippy has some great suggestions that contain working code, like the message below:

   --> src/data_types.rs:143:63
    |
143 |                   hashed_conditions.get(&condition.description).expect(
    |  _______________________________________________________________^
144 | |                     format!(
145 | |                         "[ERROR] condition in play \"{}\" not found in \"conditions.yaml\".",
146 | |                         &condition.description
147 | |                     )
148 | |                     .as_str(),
149 | |                 );
    | |_________________^ help: try this: 'unwrap_or_else(|| panic!("[ERROR] condition in play \"{}\" not found in \"conditions.yaml\".", &condition.description))'
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call

I'd like to set a flag that makes these lint suggestions interactive. I'd like to be able to accept a code suggestion provided by clippy and have clippy update the code in my file. Would be curious to get other peoples' take on this idea.

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