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