Skip to content

Make clone_on_copy lint machine applicable #4826

Closed
@jyn514

Description

@jyn514

Copy/pasted from rust-lang/rustfix#182:

This gives a warning instead of replacing it with the suggested code:

$ cargo +nightly fix -Z unstable-options --clippy
warning: using `clone` on a `Copy` type
   --> src/parse/mod.rs:258:27
    |
258 |                 location: self.next_location().clone(),
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*self.next_location()`

It would be really nice to have this be done automatically, since I currently have about 20 of these warnings in my code.

$ cargo +nightly --version
cargo 1.40.0-nightly (5da4b4d47 2019-10-28)
$ cargo +nightly clippy -V
clippy 0.0.212 (b4f17697 2019-11-14)

Metadata

Metadata

Assignees

No one assigned

    Labels

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