@@ -85,16 +85,46 @@ help: try dereferencing it
85
85
|
86
86
LL | let z: &Vec<_> = &(*y).clone();
87
87
| ^^^^^^^^^^^^^
88
- help: or try being explicit about what type to clone
88
+ help: or try being explicit if you are sure, that you want to clone a reference
89
89
|
90
- LL | let z: &Vec<_> = &std::vec::Vec<i32>::clone(y);
91
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90
+ LL | let z: &Vec<_> = < &std::vec::Vec<i32> >::clone(y);
91
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92
92
93
93
error: using `clone` on a `Copy` type
94
94
--> $DIR/unnecessary_clone.rs:109:20
95
95
|
96
96
LL | let _: E = a.clone();
97
97
| ^^^^^^^^^ help: try dereferencing it: `*****a`
98
98
99
- error: aborting due to 14 previous errors
99
+ 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
101
+ |
102
+ LL | let _ = &mut encoded.clone();
103
+ | ^^^^^^^^^^^^^^^
104
+ |
105
+ help: try dereferencing it
106
+ |
107
+ LL | let _ = &mut &(*encoded).clone();
108
+ | ^^^^^^^^^^^^^^^^^^^
109
+ help: or try being explicit if you are sure, that you want to clone a reference
110
+ |
111
+ LL | let _ = &mut <&[u8]>::clone(encoded);
112
+ | ^^^^^^^^^^^^^^^^^^^^^^^
113
+
114
+ 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
116
+ |
117
+ LL | let _ = &encoded.clone();
118
+ | ^^^^^^^^^^^^^^^
119
+ |
120
+ help: try dereferencing it
121
+ |
122
+ LL | let _ = &&(*encoded).clone();
123
+ | ^^^^^^^^^^^^^^^^^^^
124
+ help: or try being explicit if you are sure, that you want to clone a reference
125
+ |
126
+ LL | let _ = &<&[u8]>::clone(encoded);
127
+ | ^^^^^^^^^^^^^^^^^^^^^^^
128
+
129
+ error: aborting due to 16 previous errors
100
130
0 commit comments