mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 07:04:18 +00:00
185 lines
7.9 KiB
Text
185 lines
7.9 KiB
Text
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:25:5
|
|
|
|
|
LL | *mut_thing = value_thing.clone();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `mut_thing.clone_from(&value_thing)`
|
|
|
|
|
= note: `-D clippy::assigning-clones` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::assigning_clones)]`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:29:5
|
|
|
|
|
LL | *mut_thing = ref_thing.clone();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `mut_thing.clone_from(ref_thing)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:33:5
|
|
|
|
|
LL | mut_thing = ref_thing.clone();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `mut_thing.clone_from(ref_thing)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:37:5
|
|
|
|
|
LL | *mut_thing = Clone::clone(ref_thing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(mut_thing, ref_thing)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:41:5
|
|
|
|
|
LL | mut_thing = Clone::clone(ref_thing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(&mut mut_thing, ref_thing)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:45:5
|
|
|
|
|
LL | *mut_thing = Clone::clone(ref_thing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(mut_thing, ref_thing)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:49:5
|
|
|
|
|
LL | *mut_thing = HasCloneFrom::clone(ref_thing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(mut_thing, ref_thing)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:53:5
|
|
|
|
|
LL | *mut_thing = <HasCloneFrom as Clone>::clone(ref_thing);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(mut_thing, ref_thing)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:58:5
|
|
|
|
|
LL | *(mut_thing + &mut HasCloneFrom) = ref_thing.clone();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `(mut_thing + &mut HasCloneFrom).clone_from(ref_thing)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:63:5
|
|
|
|
|
LL | *mut_thing = (ref_thing + ref_thing).clone();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `mut_thing.clone_from(ref_thing + ref_thing)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:68:5
|
|
|
|
|
LL | s = format!("{} {}", "hello", "world").clone();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `s.clone_from(&format!("{} {}", "hello", "world"))`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:73:5
|
|
|
|
|
LL | s = Clone::clone(&format!("{} {}", "hello", "world"));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(&mut s, &format!("{} {}", "hello", "world"))`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:79:9
|
|
|
|
|
LL | a = b.clone();
|
|
| ^^^^^^^^^^^^^ help: use `clone_from()`: `a.clone_from(&b)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:150:5
|
|
|
|
|
LL | a = b.clone();
|
|
| ^^^^^^^^^^^^^ help: use `clone_from()`: `a.clone_from(&b)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:157:5
|
|
|
|
|
LL | a = b.clone();
|
|
| ^^^^^^^^^^^^^ help: use `clone_from()`: `a.clone_from(&b)`
|
|
|
|
error: assigning the result of `ToOwned::to_owned()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:158:5
|
|
|
|
|
LL | a = c.to_owned();
|
|
| ^^^^^^^^^^^^^^^^ help: use `clone_into()`: `c.clone_into(&mut a)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:188:5
|
|
|
|
|
LL | *a = b.clone();
|
|
| ^^^^^^^^^^^^^^ help: use `clone_from()`: `(*a).clone_from(&b)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:192:5
|
|
|
|
|
LL | *a = b.clone();
|
|
| ^^^^^^^^^^^^^^ help: use `clone_from()`: `(*a).clone_from(&b)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:196:5
|
|
|
|
|
LL | *a = b.clone();
|
|
| ^^^^^^^^^^^^^^ help: use `clone_from()`: `(*a).clone_from(&b)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:200:5
|
|
|
|
|
LL | *a = b.clone();
|
|
| ^^^^^^^^^^^^^^ help: use `clone_from()`: `a.clone_from(&b)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:204:5
|
|
|
|
|
LL | *a = Clone::clone(&b);
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(&mut *a, &b)`
|
|
|
|
error: assigning the result of `Clone::clone()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:208:5
|
|
|
|
|
LL | *a = Clone::clone(&b);
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `Clone::clone_from(&mut *a, &b)`
|
|
|
|
error: assigning the result of `ToOwned::to_owned()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:213:5
|
|
|
|
|
LL | *mut_string = ref_str.to_owned();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ref_str.clone_into(mut_string)`
|
|
|
|
error: assigning the result of `ToOwned::to_owned()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:217:5
|
|
|
|
|
LL | mut_string = ref_str.to_owned();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ref_str.clone_into(&mut mut_string)`
|
|
|
|
error: assigning the result of `ToOwned::to_owned()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:238:5
|
|
|
|
|
LL | **mut_box_string = ref_str.to_owned();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ref_str.clone_into(&mut (*mut_box_string))`
|
|
|
|
error: assigning the result of `ToOwned::to_owned()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:242:5
|
|
|
|
|
LL | **mut_box_string = ref_str.to_owned();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ref_str.clone_into(&mut (*mut_box_string))`
|
|
|
|
error: assigning the result of `ToOwned::to_owned()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:246:5
|
|
|
|
|
LL | *mut_thing = ToOwned::to_owned(ref_str);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ToOwned::clone_into(ref_str, mut_thing)`
|
|
|
|
error: assigning the result of `ToOwned::to_owned()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:250:5
|
|
|
|
|
LL | mut_thing = ToOwned::to_owned(ref_str);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ToOwned::clone_into(ref_str, &mut mut_thing)`
|
|
|
|
error: assigning the result of `ToOwned::to_owned()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:255:5
|
|
|
|
|
LL | s = format!("{} {}", "hello", "world").to_owned();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `format!("{} {}", "hello", "world").clone_into(&mut s)`
|
|
|
|
error: assigning the result of `ToOwned::to_owned()` may be inefficient
|
|
--> tests/ui/assigning_clones.rs:260:5
|
|
|
|
|
LL | s = ToOwned::to_owned(&format!("{} {}", "hello", "world"));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `ToOwned::clone_into(&format!("{} {}", "hello", "world"), &mut s)`
|
|
|
|
error: aborting due to 30 previous errors
|
|
|