1- error: using `clone` on a `Copy` type
2- --> $DIR/unnecessary_clone.rs:21:5
3- |
4- LL | 42.clone();
5- | ^^^^^^^^^^ help: try removing the `clone` call: `42`
6- |
7- = note: `-D clippy::clone-on-copy` implied by `-D warnings`
8-
9- error: using `clone` on a `Copy` type
10- --> $DIR/unnecessary_clone.rs:25:5
11- |
12- LL | (&42).clone();
13- | ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`
14-
15- error: using `clone` on a `Copy` type
16- --> $DIR/unnecessary_clone.rs:28:5
17- |
18- LL | rc.borrow().clone();
19- | ^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*rc.borrow()`
20-
21- error: using `clone` on a `Copy` type
22- --> $DIR/unnecessary_clone.rs:34:14
23- |
24- LL | is_ascii('z'.clone());
25- | ^^^^^^^^^^^ help: try removing the `clone` call: `'z'`
26-
27- error: using `clone` on a `Copy` type
28- --> $DIR/unnecessary_clone.rs:38:14
29- |
30- LL | vec.push(42.clone());
31- | ^^^^^^^^^^ help: try removing the `clone` call: `42`
32-
331error: using `.clone()` on a ref-counted pointer
34- --> $DIR/unnecessary_clone.rs:48 :5
2+ --> $DIR/unnecessary_clone.rs:23 :5
353 |
364LL | rc.clone();
375 | ^^^^^^^^^^ help: try this: `Rc::<bool>::clone(&rc)`
386 |
397 = note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings`
408
419error: using `.clone()` on a ref-counted pointer
42- --> $DIR/unnecessary_clone.rs:51 :5
10+ --> $DIR/unnecessary_clone.rs:26 :5
4311 |
4412LL | arc.clone();
4513 | ^^^^^^^^^^^ help: try this: `Arc::<bool>::clone(&arc)`
4614
4715error: using `.clone()` on a ref-counted pointer
48- --> $DIR/unnecessary_clone.rs:54 :5
16+ --> $DIR/unnecessary_clone.rs:29 :5
4917 |
5018LL | rcweak.clone();
5119 | ^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&rcweak)`
5220
5321error: using `.clone()` on a ref-counted pointer
54- --> $DIR/unnecessary_clone.rs:57 :5
22+ --> $DIR/unnecessary_clone.rs:32 :5
5523 |
5624LL | arc_weak.clone();
5725 | ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
5826
5927error: using `.clone()` on a ref-counted pointer
60- --> $DIR/unnecessary_clone.rs:61 :33
28+ --> $DIR/unnecessary_clone.rs:36 :33
6129 |
6230LL | let _: Arc<dyn SomeTrait> = x.clone();
6331 | ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
6432
6533error: using `clone` on a `Copy` type
66- --> $DIR/unnecessary_clone.rs:65 :5
34+ --> $DIR/unnecessary_clone.rs:40 :5
6735 |
6836LL | t.clone();
6937 | ^^^^^^^^^ help: try removing the `clone` call: `t`
38+ |
39+ = note: `-D clippy::clone-on-copy` implied by `-D warnings`
7040
7141error: using `clone` on a `Copy` type
72- --> $DIR/unnecessary_clone.rs:67 :5
42+ --> $DIR/unnecessary_clone.rs:42 :5
7343 |
7444LL | Some(t).clone();
7545 | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
7646
7747error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
78- --> $DIR/unnecessary_clone.rs:73 :22
48+ --> $DIR/unnecessary_clone.rs:48 :22
7949 |
8050LL | let z: &Vec<_> = y.clone();
8151 | ^^^^^^^^^
@@ -91,13 +61,13 @@ LL | let z: &Vec<_> = <&std::vec::Vec<i32>>::clone(y);
9161 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9262
9363error: using `clone` on a `Copy` type
94- --> $DIR/unnecessary_clone.rs:109 :20
64+ --> $DIR/unnecessary_clone.rs:84 :20
9565 |
9666LL | let _: E = a.clone();
9767 | ^^^^^^^^^ help: try dereferencing it: `*****a`
9868
9969error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
100- --> $DIR/unnecessary_clone.rs:114 :22
70+ --> $DIR/unnecessary_clone.rs:89 :22
10171 |
10272LL | let _ = &mut encoded.clone();
10373 | ^^^^^^^^^^^^^^^
@@ -112,7 +82,7 @@ LL | let _ = &mut <&[u8]>::clone(encoded);
11282 | ^^^^^^^^^^^^^^^^^^^^^^^
11383
11484error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
115- --> $DIR/unnecessary_clone.rs:115 :18
85+ --> $DIR/unnecessary_clone.rs:90 :18
11686 |
11787LL | let _ = &encoded.clone();
11888 | ^^^^^^^^^^^^^^^
@@ -126,5 +96,5 @@ help: or try being explicit if you are sure, that you want to clone a reference
12696LL | let _ = &<&[u8]>::clone(encoded);
12797 | ^^^^^^^^^^^^^^^^^^^^^^^
12898
129- error: aborting due to 16 previous errors
99+ error: aborting due to 11 previous errors
130100
0 commit comments