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