11error: using `clone` on a `Copy` type
2- --> $DIR/unnecessary_clone.rs:17 :5
2+ --> $DIR/unnecessary_clone.rs:21 :5
33 |
44LL | 42.clone();
55 | ^^^^^^^^^^ help: try removing the `clone` call: `42`
66 |
77 = note: `-D clippy::clone-on-copy` implied by `-D warnings`
88
99error: using `clone` on a `Copy` type
10- --> $DIR/unnecessary_clone.rs:21 :5
10+ --> $DIR/unnecessary_clone.rs:25 :5
1111 |
1212LL | (&42).clone();
1313 | ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`
1414
1515error: using `clone` on a `Copy` type
16- --> $DIR/unnecessary_clone.rs:24 :5
16+ --> $DIR/unnecessary_clone.rs:28 :5
1717 |
1818LL | rc.borrow().clone();
1919 | ^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*rc.borrow()`
2020
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+
2133error: using `.clone()` on a ref-counted pointer
22- --> $DIR/unnecessary_clone.rs:39 :5
34+ --> $DIR/unnecessary_clone.rs:48 :5
2335 |
2436LL | rc.clone();
2537 | ^^^^^^^^^^ help: try this: `Rc::<bool>::clone(&rc)`
2638 |
2739 = note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings`
2840
2941error: using `.clone()` on a ref-counted pointer
30- --> $DIR/unnecessary_clone.rs:42 :5
42+ --> $DIR/unnecessary_clone.rs:51 :5
3143 |
3244LL | arc.clone();
3345 | ^^^^^^^^^^^ help: try this: `Arc::<bool>::clone(&arc)`
3446
3547error: using `.clone()` on a ref-counted pointer
36- --> $DIR/unnecessary_clone.rs:45 :5
48+ --> $DIR/unnecessary_clone.rs:54 :5
3749 |
3850LL | rcweak.clone();
3951 | ^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&rcweak)`
4052
4153error: using `.clone()` on a ref-counted pointer
42- --> $DIR/unnecessary_clone.rs:48 :5
54+ --> $DIR/unnecessary_clone.rs:57 :5
4355 |
4456LL | arc_weak.clone();
4557 | ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
4658
4759error: using `.clone()` on a ref-counted pointer
48- --> $DIR/unnecessary_clone.rs:52 :33
60+ --> $DIR/unnecessary_clone.rs:61 :33
4961 |
5062LL | let _: Arc<dyn SomeTrait> = x.clone();
5163 | ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
5264
5365error: using `clone` on a `Copy` type
54- --> $DIR/unnecessary_clone.rs:56 :5
66+ --> $DIR/unnecessary_clone.rs:65 :5
5567 |
5668LL | t.clone();
5769 | ^^^^^^^^^ help: try removing the `clone` call: `t`
5870
5971error: using `clone` on a `Copy` type
60- --> $DIR/unnecessary_clone.rs:58 :5
72+ --> $DIR/unnecessary_clone.rs:67 :5
6173 |
6274LL | Some(t).clone();
6375 | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
6476
6577error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
66- --> $DIR/unnecessary_clone.rs:64 :22
78+ --> $DIR/unnecessary_clone.rs:73 :22
6779 |
6880LL | let z: &Vec<_> = y.clone();
6981 | ^^^^^^^^^
@@ -79,10 +91,10 @@ LL | let z: &Vec<_> = &std::vec::Vec<i32>::clone(y);
7991 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8092
8193error: using `clone` on a `Copy` type
82- --> $DIR/unnecessary_clone.rs:100 :20
94+ --> $DIR/unnecessary_clone.rs:109 :20
8395 |
8496LL | let _: E = a.clone();
8597 | ^^^^^^^^^ help: try dereferencing it: `*****a`
8698
87- error: aborting due to 12 previous errors
99+ error: aborting due to 14 previous errors
88100
0 commit comments