]> git.lizzy.rs Git - rust.git/blob - tests/ui/unnecessary_clone.stderr
Merge pull request #2119 from camsteffen/never_loop
[rust.git] / tests / ui / unnecessary_clone.stderr
1 error: using `clone` on a `Copy` type
2   --> $DIR/unnecessary_clone.rs:11:5
3    |
4 11 |     42.clone();
5    |     ^^^^^^^^^^ help: try removing the `clone` call: `42`
6    |
7    = note: `-D clone-on-copy` implied by `-D warnings`
8
9 error: using `clone` on a `Copy` type
10   --> $DIR/unnecessary_clone.rs:15:5
11    |
12 15 |     (&42).clone();
13    |     ^^^^^^^^^^^^^ help: try dereferencing it: `*(&42)`
14
15 error: using '.clone()' on a ref-counted pointer
16   --> $DIR/unnecessary_clone.rs:25:5
17    |
18 25 |     rc.clone();
19    |     ^^^^^^^^^^ help: try this: `Rc::clone(&rc)`
20    |
21    = note: `-D clone-on-ref-ptr` implied by `-D warnings`
22
23 error: using '.clone()' on a ref-counted pointer
24   --> $DIR/unnecessary_clone.rs:28:5
25    |
26 28 |     arc.clone();
27    |     ^^^^^^^^^^^ help: try this: `Arc::clone(&arc)`
28
29 error: using '.clone()' on a ref-counted pointer
30   --> $DIR/unnecessary_clone.rs:31:5
31    |
32 31 |     rcweak.clone();
33    |     ^^^^^^^^^^^^^^ help: try this: `Weak::clone(&rcweak)`
34
35 error: using '.clone()' on a ref-counted pointer
36   --> $DIR/unnecessary_clone.rs:34:5
37    |
38 34 |     arc_weak.clone();
39    |     ^^^^^^^^^^^^^^^^ help: try this: `Weak::clone(&arc_weak)`
40
41 error: using `clone` on a `Copy` type
42   --> $DIR/unnecessary_clone.rs:41:5
43    |
44 41 |     t.clone();
45    |     ^^^^^^^^^ help: try removing the `clone` call: `t`
46
47 error: using `clone` on a `Copy` type
48   --> $DIR/unnecessary_clone.rs:43:5
49    |
50 43 |     Some(t).clone();
51    |     ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)`
52
53 error: using `clone` on a double-reference; this will copy the reference instead of cloning the inner type
54   --> $DIR/unnecessary_clone.rs:49:22
55    |
56 49 |     let z: &Vec<_> = y.clone();
57    |                      ^^^^^^^^^ help: try dereferencing it: `(*y).clone()`
58    |
59    = note: `-D clone-double-ref` implied by `-D warnings`
60
61 error: called `cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable
62   --> $DIR/unnecessary_clone.rs:56:27
63    |
64 56 |     let v2 : Vec<isize> = v.iter().cloned().collect();
65    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66    |
67    = note: `-D iter-cloned-collect` implied by `-D warnings`
68