diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-02-23 09:42:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-23 09:42:11 +0100 |
| commit | 86727df4ed725994130b54b146a16773eff560be (patch) | |
| tree | 1f2ff8e85a53f5d6321ab8aebc878436c90db2a6 /compiler/rustc_pattern_analysis/src | |
| parent | 6e00f0d189bc963fba2f1c2996b3b6cff9df30ce (diff) | |
| parent | 6017de46f7864cabcf4770f11c93f319314a250f (diff) | |
| download | rust-86727df4ed725994130b54b146a16773eff560be.tar.gz rust-86727df4ed725994130b54b146a16773eff560be.zip | |
Rollup merge of #121471 - estebank:lint-clone, r=TaKO8Ki
When encountering `<&T as Clone>::clone(x)` because `T: Clone`, suggest `#[derive(Clone)]` CC #40699. ``` warning: call to `.clone()` on a reference in this situation does nothing --> $DIR/noop-method-call.rs:23:71 | LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone(); | ^^^^^^^^ | = note: the type `PlainType<u32>` does not implement `Clone`, so calling `clone` on `&PlainType<u32>` copies the reference, which does not do anything and can be removed help: remove this redundant call | LL - let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone(); LL + let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref; | help: if you meant to clone `PlainType<u32>`, implement `Clone` for it | LL + #[derive(Clone)] LL | struct PlainType<T>(T); | ```
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions
