|
1 | 1 | error: using `clone` on a `Copy` type
|
2 |
| - --> $DIR/unnecessary_clone.rs:28:5 |
| 2 | + --> $DIR/unnecessary_clone.rs:29:5 |
3 | 3 | |
|
4 |
| -28 | 42.clone(); |
| 4 | +29 | 42.clone(); |
5 | 5 | | ^^^^^^^^^^ help: try removing the `clone` call: `42`
|
6 | 6 | |
|
7 | 7 | = note: `-D clippy::clone-on-copy` implied by `-D warnings`
|
8 | 8 |
|
9 | 9 | error: using `clone` on a `Copy` type
|
10 |
| - --> $DIR/unnecessary_clone.rs:32:5 |
| 10 | + --> $DIR/unnecessary_clone.rs:33:5 |
11 | 11 | |
|
12 |
| -32 | (&42).clone(); |
| 12 | +33 | (&42).clone(); |
13 | 13 | | ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`
|
14 | 14 |
|
| 15 | +error: using `clone` on a `Copy` type |
| 16 | + --> $DIR/unnecessary_clone.rs:36:5 |
| 17 | + | |
| 18 | +36 | rc.borrow().clone(); |
| 19 | + | ^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*rc.borrow()` |
| 20 | + |
15 | 21 | error: using '.clone()' on a ref-counted pointer
|
16 |
| - --> $DIR/unnecessary_clone.rs:42:5 |
| 22 | + --> $DIR/unnecessary_clone.rs:46:5 |
17 | 23 | |
|
18 |
| -42 | rc.clone(); |
| 24 | +46 | rc.clone(); |
19 | 25 | | ^^^^^^^^^^ help: try this: `Rc::<bool>::clone(&rc)`
|
20 | 26 | |
|
21 | 27 | = note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings`
|
22 | 28 |
|
23 | 29 | error: using '.clone()' on a ref-counted pointer
|
24 |
| - --> $DIR/unnecessary_clone.rs:45:5 |
| 30 | + --> $DIR/unnecessary_clone.rs:49:5 |
25 | 31 | |
|
26 |
| -45 | arc.clone(); |
| 32 | +49 | arc.clone(); |
27 | 33 | | ^^^^^^^^^^^ help: try this: `Arc::<bool>::clone(&arc)`
|
28 | 34 |
|
29 | 35 | error: using '.clone()' on a ref-counted pointer
|
30 |
| - --> $DIR/unnecessary_clone.rs:48:5 |
| 36 | + --> $DIR/unnecessary_clone.rs:52:5 |
31 | 37 | |
|
32 |
| -48 | rcweak.clone(); |
| 38 | +52 | rcweak.clone(); |
33 | 39 | | ^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&rcweak)`
|
34 | 40 |
|
35 | 41 | error: using '.clone()' on a ref-counted pointer
|
36 |
| - --> $DIR/unnecessary_clone.rs:51:5 |
| 42 | + --> $DIR/unnecessary_clone.rs:55:5 |
37 | 43 | |
|
38 |
| -51 | arc_weak.clone(); |
| 44 | +55 | arc_weak.clone(); |
39 | 45 | | ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
|
40 | 46 |
|
41 | 47 | error: using '.clone()' on a ref-counted pointer
|
42 |
| - --> $DIR/unnecessary_clone.rs:55:29 |
| 48 | + --> $DIR/unnecessary_clone.rs:59:29 |
43 | 49 | |
|
44 |
| -55 | let _: Arc<SomeTrait> = x.clone(); |
| 50 | +59 | let _: Arc<SomeTrait> = x.clone(); |
45 | 51 | | ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
|
46 | 52 |
|
47 | 53 | error: using `clone` on a `Copy` type
|
48 |
| - --> $DIR/unnecessary_clone.rs:59:5 |
| 54 | + --> $DIR/unnecessary_clone.rs:63:5 |
49 | 55 | |
|
50 |
| -59 | t.clone(); |
| 56 | +63 | t.clone(); |
51 | 57 | | ^^^^^^^^^ help: try removing the `clone` call: `t`
|
52 | 58 |
|
53 | 59 | error: using `clone` on a `Copy` type
|
54 |
| - --> $DIR/unnecessary_clone.rs:61:5 |
| 60 | + --> $DIR/unnecessary_clone.rs:65:5 |
55 | 61 | |
|
56 |
| -61 | Some(t).clone(); |
| 62 | +65 | Some(t).clone(); |
57 | 63 | | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
|
58 | 64 |
|
59 | 65 | error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
|
60 |
| - --> $DIR/unnecessary_clone.rs:67:22 |
| 66 | + --> $DIR/unnecessary_clone.rs:71:22 |
61 | 67 | |
|
62 |
| -67 | let z: &Vec<_> = y.clone(); |
| 68 | +71 | let z: &Vec<_> = y.clone(); |
63 | 69 | | ^^^^^^^^^
|
64 | 70 | |
|
65 | 71 | = note: #[deny(clippy::clone_double_ref)] on by default
|
66 | 72 | help: try dereferencing it
|
67 | 73 | |
|
68 |
| -67 | let z: &Vec<_> = &(*y).clone(); |
| 74 | +71 | let z: &Vec<_> = &(*y).clone(); |
69 | 75 | | ^^^^^^^^^^^^^
|
70 | 76 | help: or try being explicit about what type to clone
|
71 | 77 | |
|
72 |
| -67 | let z: &Vec<_> = &std::vec::Vec<i32>::clone(y); |
| 78 | +71 | let z: &Vec<_> = &std::vec::Vec<i32>::clone(y); |
73 | 79 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
74 | 80 |
|
75 | 81 | error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
|
76 |
| - --> $DIR/unnecessary_clone.rs:74:27 |
| 82 | + --> $DIR/unnecessary_clone.rs:78:27 |
77 | 83 | |
|
78 |
| -74 | let v2 : Vec<isize> = v.iter().cloned().collect(); |
| 84 | +78 | let v2 : Vec<isize> = v.iter().cloned().collect(); |
79 | 85 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
80 | 86 | |
|
81 | 87 | = note: `-D clippy::iter-cloned-collect` implied by `-D warnings`
|
82 | 88 |
|
83 |
| -error: aborting due to 11 previous errors |
| 89 | +error: using `clone` on a `Copy` type |
| 90 | + --> $DIR/unnecessary_clone.rs:110:20 |
| 91 | + | |
| 92 | +110 | let _: E = a.clone(); |
| 93 | + | ^^^^^^^^^ help: try dereferencing it: `*****a` |
| 94 | + |
| 95 | +error: aborting due to 13 previous errors |
84 | 96 |
|
0 commit comments