]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unnecessary_clone.stderr
Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup
[rust.git] / src / tools / clippy / 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: using `.clone()` on a ref-counted pointer
28   --> $DIR/unnecessary_clone.rs:36:33
29    |
30 LL |     let _: Arc<dyn SomeTrait> = x.clone();
31    |                                 ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
32
33 error: using `clone` on a `Copy` type
34   --> $DIR/unnecessary_clone.rs:40:5
35    |
36 LL |     t.clone();
37    |     ^^^^^^^^^ help: try removing the `clone` call: `t`
38    |
39    = note: `-D clippy::clone-on-copy` implied by `-D warnings`
40
41 error: using `clone` on a `Copy` type
42   --> $DIR/unnecessary_clone.rs:42:5
43    |
44 LL |     Some(t).clone();
45    |     ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
46
47 error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
48   --> $DIR/unnecessary_clone.rs:48:22
49    |
50 LL |     let z: &Vec<_> = y.clone();
51    |                      ^^^^^^^^^
52    |
53    = note: `#[deny(clippy::clone_double_ref)]` on by default
54 help: try dereferencing it
55    |
56 LL |     let z: &Vec<_> = &(*y).clone();
57    |                      ^^^^^^^^^^^^^
58 help: or try being explicit if you are sure, that you want to clone a reference
59    |
60 LL |     let z: &Vec<_> = <&std::vec::Vec<i32>>::clone(y);
61    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62
63 error: using `clone` on a `Copy` type
64   --> $DIR/unnecessary_clone.rs:84:20
65    |
66 LL |         let _: E = a.clone();
67    |                    ^^^^^^^^^ help: try dereferencing it: `*****a`
68
69 error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
70   --> $DIR/unnecessary_clone.rs:89:22
71    |
72 LL |         let _ = &mut encoded.clone();
73    |                      ^^^^^^^^^^^^^^^
74    |
75 help: try dereferencing it
76    |
77 LL |         let _ = &mut &(*encoded).clone();
78    |                      ^^^^^^^^^^^^^^^^^^^
79 help: or try being explicit if you are sure, that you want to clone a reference
80    |
81 LL |         let _ = &mut <&[u8]>::clone(encoded);
82    |                      ^^^^^^^^^^^^^^^^^^^^^^^
83
84 error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
85   --> $DIR/unnecessary_clone.rs:90:18
86    |
87 LL |         let _ = &encoded.clone();
88    |                  ^^^^^^^^^^^^^^^
89    |
90 help: try dereferencing it
91    |
92 LL |         let _ = &&(*encoded).clone();
93    |                  ^^^^^^^^^^^^^^^^^^^
94 help: or try being explicit if you are sure, that you want to clone a reference
95    |
96 LL |         let _ = &<&[u8]>::clone(encoded);
97    |                  ^^^^^^^^^^^^^^^^^^^^^^^
98
99 error: aborting due to 11 previous errors
100