mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
86727df4ed
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); | ``` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |