You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: using `clone` on a double-reference, which copies the reference of type `Vec<i32>` instead of cloning the inner type
2
-
--> $DIR/clone-double-ref.rs:7:22
1
+
error: using `.clone()` on a doublereference, which copies `&Vec<i32>` instead of cloning the inner type
2
+
--> $DIR/clone-double-ref.rs:7:23
3
3
|
4
4
LL | let z: &Vec<_> = y.clone();
5
-
| ^^^^^^^^^
5
+
| ^^^^^^^^
6
6
|
7
7
note: the lint level is defined here
8
8
--> $DIR/clone-double-ref.rs:2:9
9
9
|
10
-
LL | #![deny(clone_double_ref)]
10
+
LL | #![deny(clone_double_ref, noop_method_call)]
11
11
| ^^^^^^^^^^^^^^^^
12
-
help: try dereferencing it
12
+
13
+
error: call to `.clone()` on a reference in this situation does nothing
14
+
--> $DIR/clone-double-ref.rs:24:25
15
+
|
16
+
LL | let _ = &mut encoded.clone();
17
+
| ^^^^^^^^ unnecessary method call
18
+
|
19
+
= note: the type `&[u8]` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
20
+
note: the lint level is defined here
21
+
--> $DIR/clone-double-ref.rs:2:27
22
+
|
23
+
LL | #![deny(clone_double_ref, noop_method_call)]
24
+
| ^^^^^^^^^^^^^^^^
25
+
26
+
error: call to `.clone()` on a reference in this situation does nothing
27
+
--> $DIR/clone-double-ref.rs:26:21
13
28
|
14
-
LL | let z: &Vec<_> = &(*y).clone();
15
-
| +++ ~~~~~~~~~
16
-
help: or try being explicit if you are sure, that you want to clone a reference
29
+
LL | let _ = &encoded.clone();
30
+
| ^^^^^^^^ unnecessary method call
17
31
|
18
-
LL | let z: &Vec<_> = <&Vec<i32>>::clone(y);
19
-
| +++++++++++++++++++ ~
32
+
= note: the type `&[u8]` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed
0 commit comments