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