]> git.lizzy.rs Git - rust.git/blob - tests/ui/unnecessary_clone.stderr
Adapt the *.stderr files of the ui-tests to the tool_lints
[rust.git] / tests / ui / unnecessary_clone.stderr
1 error: using `clone` on a `Copy` type
2   --> $DIR/unnecessary_clone.rs:18:5
3    |
4 18 |     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:22:5
11    |
12 22 |     (&42).clone();
13    |     ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`
14
15 error: using '.clone()' on a ref-counted pointer
16   --> $DIR/unnecessary_clone.rs:32:5
17    |
18 32 |     rc.clone();
19    |     ^^^^^^^^^^ help: try this: `Rc::<bool>::clone(&rc)`
20    |
21    = note: `-D clippy::clone-on-ref-ptr` implied by `-D warnings`
22
23 error: using '.clone()' on a ref-counted pointer
24   --> $DIR/unnecessary_clone.rs:35:5
25    |
26 35 |     arc.clone();
27    |     ^^^^^^^^^^^ help: try this: `Arc::<bool>::clone(&arc)`
28
29 error: using '.clone()' on a ref-counted pointer
30   --> $DIR/unnecessary_clone.rs:38:5
31    |
32 38 |     rcweak.clone();
33    |     ^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&rcweak)`
34
35 error: using '.clone()' on a ref-counted pointer
36   --> $DIR/unnecessary_clone.rs:41:5
37    |
38 41 |     arc_weak.clone();
39    |     ^^^^^^^^^^^^^^^^ help: try this: `Weak::<bool>::clone(&arc_weak)`
40
41 error: using '.clone()' on a ref-counted pointer
42   --> $DIR/unnecessary_clone.rs:45:29
43    |
44 45 |     let _: Arc<SomeTrait> = x.clone();
45    |                             ^^^^^^^^^ help: try this: `Arc::<SomeImpl>::clone(&x)`
46
47 error: using `clone` on a `Copy` type
48   --> $DIR/unnecessary_clone.rs:49:5
49    |
50 49 |     t.clone();
51    |     ^^^^^^^^^ help: try removing the `clone` call: `t`
52
53 error: using `clone` on a `Copy` type
54   --> $DIR/unnecessary_clone.rs:51:5
55    |
56 51 |     Some(t).clone();
57    |     ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
58
59 error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
60   --> $DIR/unnecessary_clone.rs:57:22
61    |
62 57 |     let z: &Vec<_> = y.clone();
63    |                      ^^^^^^^^^
64    |
65    = note: #[deny(clippy::clone_double_ref)] on by default
66 help: try dereferencing it
67    |
68 57 |     let z: &Vec<_> = &(*y).clone();
69    |                      ^^^^^^^^^^^^^
70 help: or try being explicit about what type to clone
71    |
72 57 |     let z: &Vec<_> = &std::vec::Vec<i32>::clone(y);
73    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
74
75 error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
76   --> $DIR/unnecessary_clone.rs:64:27
77    |
78 64 |     let v2 : Vec<isize> = v.iter().cloned().collect();
79    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
80    |
81    = note: `-D clippy::iter-cloned-collect` implied by `-D warnings`
82
83 error: aborting due to 11 previous errors
84