1
1
error: this call to `as_ref` does nothing
2
- --> $DIR/useless_asref.rs:46 :18
2
+ --> $DIR/useless_asref.rs:48 :18
3
3
|
4
4
LL | foo_rstr(rstr.as_ref());
5
5
| ^^^^^^^^^^^^^ help: try: `rstr`
@@ -11,79 +11,82 @@ LL | #![deny(clippy::useless_asref)]
11
11
| ^^^^^^^^^^^^^^^^^^^^^
12
12
13
13
error: this call to `as_ref` does nothing
14
- --> $DIR/useless_asref.rs:48 :20
14
+ --> $DIR/useless_asref.rs:50 :20
15
15
|
16
16
LL | foo_rslice(rslice.as_ref());
17
17
| ^^^^^^^^^^^^^^^ help: try: `rslice`
18
18
19
19
error: this call to `as_mut` does nothing
20
- --> $DIR/useless_asref.rs:52 :21
20
+ --> $DIR/useless_asref.rs:54 :21
21
21
|
22
22
LL | foo_mrslice(mrslice.as_mut());
23
23
| ^^^^^^^^^^^^^^^^ help: try: `mrslice`
24
24
25
25
error: this call to `as_ref` does nothing
26
- --> $DIR/useless_asref.rs:54 :20
26
+ --> $DIR/useless_asref.rs:56 :20
27
27
|
28
28
LL | foo_rslice(mrslice.as_ref());
29
29
| ^^^^^^^^^^^^^^^^ help: try: `mrslice`
30
30
31
31
error: this call to `as_ref` does nothing
32
- --> $DIR/useless_asref.rs:61 :20
32
+ --> $DIR/useless_asref.rs:63 :20
33
33
|
34
34
LL | foo_rslice(rrrrrslice.as_ref());
35
35
| ^^^^^^^^^^^^^^^^^^^ help: try: `rrrrrslice`
36
36
37
37
error: this call to `as_ref` does nothing
38
- --> $DIR/useless_asref.rs:63 :18
38
+ --> $DIR/useless_asref.rs:65 :18
39
39
|
40
40
LL | foo_rstr(rrrrrstr.as_ref());
41
41
| ^^^^^^^^^^^^^^^^^ help: try: `rrrrrstr`
42
42
43
43
error: this call to `as_mut` does nothing
44
- --> $DIR/useless_asref.rs:68 :21
44
+ --> $DIR/useless_asref.rs:70 :21
45
45
|
46
46
LL | foo_mrslice(mrrrrrslice.as_mut());
47
47
| ^^^^^^^^^^^^^^^^^^^^ help: try: `mrrrrrslice`
48
48
49
49
error: this call to `as_ref` does nothing
50
- --> $DIR/useless_asref.rs:70 :20
50
+ --> $DIR/useless_asref.rs:72 :20
51
51
|
52
52
LL | foo_rslice(mrrrrrslice.as_ref());
53
53
| ^^^^^^^^^^^^^^^^^^^^ help: try: `mrrrrrslice`
54
54
55
55
error: this call to `as_ref` does nothing
56
- --> $DIR/useless_asref.rs:74 :16
56
+ --> $DIR/useless_asref.rs:76 :16
57
57
|
58
58
LL | foo_rrrrmr((&&&&MoreRef).as_ref());
59
59
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&&&&MoreRef)`
60
60
61
61
error: this call to `as_mut` does nothing
62
- --> $DIR/useless_asref.rs:124 :13
62
+ --> $DIR/useless_asref.rs:126 :13
63
63
|
64
64
LL | foo_mrt(mrt.as_mut());
65
65
| ^^^^^^^^^^^^ help: try: `mrt`
66
66
67
67
error: this call to `as_ref` does nothing
68
- --> $DIR/useless_asref.rs:126 :12
68
+ --> $DIR/useless_asref.rs:128 :12
69
69
|
70
70
LL | foo_rt(mrt.as_ref());
71
71
| ^^^^^^^^^^^^ help: try: `mrt`
72
72
73
- error: you are explicitly cloning with ` .map()`
74
- --> $DIR/useless_asref.rs:137 :13
73
+ error: this call to `as_ref .map(...)` does nothing
74
+ --> $DIR/useless_asref.rs:139 :13
75
75
|
76
- LL | let y = x.as_ref().map(Clone::clone);
77
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `x.as_ref().cloned()`
76
+ LL | let z = x.as_ref().map(String::clone);
77
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.clone()`
78
+
79
+ error: this call to `as_ref.map(...)` does nothing
80
+ --> $DIR/useless_asref.rs:141:13
78
81
|
79
- = note: `-D clippy::map-clone` implied by `-D warnings`
80
- = help: to override `-D warnings` add `#[allow(clippy::map_clone)] `
82
+ LL | let z = x.as_ref().map(|z| z.clone());
83
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.clone() `
81
84
82
- error: you are explicitly cloning with ` .map()`
83
- --> $DIR/useless_asref.rs:139 :13
85
+ error: this call to `as_ref .map(...)` does nothing
86
+ --> $DIR/useless_asref.rs:143 :13
84
87
|
85
- LL | let y = x.as_ref().map(String::clone);
86
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method : `x.as_ref().cloned ()`
88
+ LL | let z = x.as_ref().map(|z| String::clone(z) );
89
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try : `x.clone ()`
87
90
88
- error: aborting due to 13 previous errors
91
+ error: aborting due to 14 previous errors
89
92
0 commit comments