1
1
error: using `clone` on a `Copy` type
2
- --> $DIR/unnecessary_clone.rs:17 :5
2
+ --> $DIR/unnecessary_clone.rs:21 :5
3
3
|
4
4
LL | 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:21 :5
10
+ --> $DIR/unnecessary_clone.rs:25 :5
11
11
|
12
12
LL | (&42).clone();
13
13
| ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`
14
14
15
15
error: using `clone` on a `Copy` type
16
- --> $DIR/unnecessary_clone.rs:24 :5
16
+ --> $DIR/unnecessary_clone.rs:28 :5
17
17
|
18
18
LL | rc.borrow().clone();
19
19
| ^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*rc.borrow()`
20
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
+
21
33
error: using `.clone()` on a ref-counted pointer
22
- --> $DIR/unnecessary_clone.rs:39 :5
34
+ --> $DIR/unnecessary_clone.rs:48 :5
23
35
|
24
36
LL | rc.clone();
25
37
| ^^^^^^^^^^ help: try this: `Rc::<bool>::clone(&rc)`
26
38
|
27
39
= note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings`
28
40
29
41
error: using `.clone()` on a ref-counted pointer
30
- --> $DIR/unnecessary_clone.rs:42 :5
42
+ --> $DIR/unnecessary_clone.rs:51 :5
31
43
|
32
44
LL | arc.clone();
33
45
| ^^^^^^^^^^^ help: try this: `Arc::<bool>::clone(&arc)`
34
46
35
47
error: using `.clone()` on a ref-counted pointer
36
- --> $DIR/unnecessary_clone.rs:45 :5
48
+ --> $DIR/unnecessary_clone.rs:54 :5
37
49
|
38
50
LL | rcweak.clone();
39
51
| ^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&rcweak)`
40
52
41
53
error: using `.clone()` on a ref-counted pointer
42
- --> $DIR/unnecessary_clone.rs:48 :5
54
+ --> $DIR/unnecessary_clone.rs:57 :5
43
55
|
44
56
LL | arc_weak.clone();
45
57
| ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
46
58
47
59
error: using `.clone()` on a ref-counted pointer
48
- --> $DIR/unnecessary_clone.rs:52 :33
60
+ --> $DIR/unnecessary_clone.rs:61 :33
49
61
|
50
62
LL | let _: Arc<dyn SomeTrait> = x.clone();
51
63
| ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
52
64
53
65
error: using `clone` on a `Copy` type
54
- --> $DIR/unnecessary_clone.rs:56 :5
66
+ --> $DIR/unnecessary_clone.rs:65 :5
55
67
|
56
68
LL | t.clone();
57
69
| ^^^^^^^^^ help: try removing the `clone` call: `t`
58
70
59
71
error: using `clone` on a `Copy` type
60
- --> $DIR/unnecessary_clone.rs:58 :5
72
+ --> $DIR/unnecessary_clone.rs:67 :5
61
73
|
62
74
LL | Some(t).clone();
63
75
| ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
64
76
65
77
error: 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
67
79
|
68
80
LL | let z: &Vec<_> = y.clone();
69
81
| ^^^^^^^^^
@@ -79,10 +91,10 @@ LL | let z: &Vec<_> = &std::vec::Vec<i32>::clone(y);
79
91
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80
92
81
93
error: using `clone` on a `Copy` type
82
- --> $DIR/unnecessary_clone.rs:100 :20
94
+ --> $DIR/unnecessary_clone.rs:109 :20
83
95
|
84
96
LL | let _: E = a.clone();
85
97
| ^^^^^^^^^ help: try dereferencing it: `*****a`
86
98
87
- error: aborting due to 12 previous errors
99
+ error: aborting due to 14 previous errors
88
100
0 commit comments