]> git.lizzy.rs Git - rust.git/blob - tests/ui/unnecessary_clone.stderr
Update references
[rust.git] / tests / ui / unnecessary_clone.stderr
1 error: using `.clone()` on a ref-counted pointer
2   --> $DIR/unnecessary_clone.rs:23:5
3    |
4 LL |     rc.clone();
5    |     ^^^^^^^^^^ help: try this: `Rc::<bool>::clone(&rc)`
6    |
7    = note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings`
8
9 error: using `.clone()` on a ref-counted pointer
10   --> $DIR/unnecessary_clone.rs:26:5
11    |
12 LL |     arc.clone();
13    |     ^^^^^^^^^^^ help: try this: `Arc::<bool>::clone(&arc)`
14
15 error: using `.clone()` on a ref-counted pointer
16   --> $DIR/unnecessary_clone.rs:29:5
17    |
18 LL |     rcweak.clone();
19    |     ^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&rcweak)`
20
21 error: using `.clone()` on a ref-counted pointer
22   --> $DIR/unnecessary_clone.rs:32:5
23    |
24 LL |     arc_weak.clone();
25    |     ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
26
27 error: non-binding let on a type that implements `Drop`
28   --> $DIR/unnecessary_clone.rs:36:5
29    |
30 LL |     let _: Arc<dyn SomeTrait> = x.clone();
31    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32    |
33    = note: `#[deny(clippy::let_underscore_drop)]` on by default
34    = help: consider using an underscore-prefixed named binding or dropping explicitly with `std::mem::drop`
35
36 error: using `.clone()` on a ref-counted pointer
37   --> $DIR/unnecessary_clone.rs:36:33
38    |
39 LL |     let _: Arc<dyn SomeTrait> = x.clone();
40    |                                 ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
41
42 error: using `clone` on a `Copy` type
43   --> $DIR/unnecessary_clone.rs:40:5
44    |
45 LL |     t.clone();
46    |     ^^^^^^^^^ help: try removing the `clone` call: `t`
47    |
48    = note: `-D clippy::clone-on-copy` implied by `-D warnings`
49
50 error: using `clone` on a `Copy` type
51   --> $DIR/unnecessary_clone.rs:42:5
52    |
53 LL |     Some(t).clone();
54    |     ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
55
56 error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
57   --> $DIR/unnecessary_clone.rs:48:22
58    |
59 LL |     let z: &Vec<_> = y.clone();
60    |                      ^^^^^^^^^
61    |
62    = note: `#[deny(clippy::clone_double_ref)]` on by default
63 help: try dereferencing it
64    |
65 LL |     let z: &Vec<_> = &(*y).clone();
66    |                      ^^^^^^^^^^^^^
67 help: or try being explicit if you are sure, that you want to clone a reference
68    |
69 LL |     let z: &Vec<_> = <&std::vec::Vec<i32>>::clone(y);
70    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71
72 error: using `clone` on a `Copy` type
73   --> $DIR/unnecessary_clone.rs:84:20
74    |
75 LL |         let _: E = a.clone();
76    |                    ^^^^^^^^^ help: try dereferencing it: `*****a`
77
78 error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
79   --> $DIR/unnecessary_clone.rs:89:22
80    |
81 LL |         let _ = &mut encoded.clone();
82    |                      ^^^^^^^^^^^^^^^
83    |
84 help: try dereferencing it
85    |
86 LL |         let _ = &mut &(*encoded).clone();
87    |                      ^^^^^^^^^^^^^^^^^^^
88 help: or try being explicit if you are sure, that you want to clone a reference
89    |
90 LL |         let _ = &mut <&[u8]>::clone(encoded);
91    |                      ^^^^^^^^^^^^^^^^^^^^^^^
92
93 error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
94   --> $DIR/unnecessary_clone.rs:90:18
95    |
96 LL |         let _ = &encoded.clone();
97    |                  ^^^^^^^^^^^^^^^
98    |
99 help: try dereferencing it
100    |
101 LL |         let _ = &&(*encoded).clone();
102    |                  ^^^^^^^^^^^^^^^^^^^
103 help: or try being explicit if you are sure, that you want to clone a reference
104    |
105 LL |         let _ = &<&[u8]>::clone(encoded);
106    |                  ^^^^^^^^^^^^^^^^^^^^^^^
107
108 error: using `.clone()` on a ref-counted pointer
109   --> $DIR/unnecessary_clone.rs:108:14
110    |
111 LL |         Some(try_opt!(Some(rc)).clone())
112    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Rc::<u8>::clone(&try_opt!(Some(rc)))`
113
114 error: aborting due to 13 previous errors
115