forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#121471 - estebank:lint-clone, r=TaKO8Ki
When encountering `<&T as Clone>::clone(x)` because `T: Clone`, suggest `#[derive(Clone)]` CC rust-lang#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); | ```
- Loading branch information
Showing
6 changed files
with
80 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
//@ check-pass | ||
//@ run-rustfix | ||
|
||
#![feature(rustc_attrs)] | ||
#![allow(unused)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters