]> git.lizzy.rs Git - rust.git/blob - tests/ui/unnecessary_clone.stderr
Auto merge of #5522 - CrazyRoka:match_vec_item, r=phansch
[rust.git] / tests / ui / unnecessary_clone.stderr
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 error: using `.clone()` on a ref-counted pointer
34   --> $DIR/unnecessary_clone.rs:48:5
35    |
36 LL |     rc.clone();
37    |     ^^^^^^^^^^ help: try this: `Rc::<bool>::clone(&rc)`
38    |
39    = note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings`
40
41 error: using `.clone()` on a ref-counted pointer
42   --> $DIR/unnecessary_clone.rs:51:5
43    |
44 LL |     arc.clone();
45    |     ^^^^^^^^^^^ help: try this: `Arc::<bool>::clone(&arc)`
46
47 error: using `.clone()` on a ref-counted pointer
48   --> $DIR/unnecessary_clone.rs:54:5
49    |
50 LL |     rcweak.clone();
51    |     ^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&rcweak)`
52
53 error: using `.clone()` on a ref-counted pointer
54   --> $DIR/unnecessary_clone.rs:57:5
55    |
56 LL |     arc_weak.clone();
57    |     ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
58
59 error: using `.clone()` on a ref-counted pointer
60   --> $DIR/unnecessary_clone.rs:61:33
61    |
62 LL |     let _: Arc<dyn SomeTrait> = x.clone();
63    |                                 ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
64
65 error: using `clone` on a `Copy` type
66   --> $DIR/unnecessary_clone.rs:65:5
67    |
68 LL |     t.clone();
69    |     ^^^^^^^^^ help: try removing the `clone` call: `t`
70
71 error: using `clone` on a `Copy` type
72   --> $DIR/unnecessary_clone.rs:67:5
73    |
74 LL |     Some(t).clone();
75    |     ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
76
77 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
79    |
80 LL |     let z: &Vec<_> = y.clone();
81    |                      ^^^^^^^^^
82    |
83    = note: `#[deny(clippy::clone_double_ref)]` on by default
84 help: try dereferencing it
85    |
86 LL |     let z: &Vec<_> = &(*y).clone();
87    |                      ^^^^^^^^^^^^^
88 help: or try being explicit about what type to clone
89    |
90 LL |     let z: &Vec<_> = &std::vec::Vec<i32>::clone(y);
91    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
92
93 error: using `clone` on a `Copy` type
94   --> $DIR/unnecessary_clone.rs:109:20
95    |
96 LL |         let _: E = a.clone();
97    |                    ^^^^^^^^^ help: try dereferencing it: `*****a`
98
99 error: aborting due to 14 previous errors
100