11error: this call to `as_ref` does nothing
2- --> $DIR/useless_asref.rs:46 :18
2+ --> $DIR/useless_asref.rs:48 :18
33 |
44LL | foo_rstr(rstr.as_ref());
55 | ^^^^^^^^^^^^^ help: try: `rstr`
@@ -11,79 +11,82 @@ LL | #![deny(clippy::useless_asref)]
1111 | ^^^^^^^^^^^^^^^^^^^^^
1212
1313error: this call to `as_ref` does nothing
14- --> $DIR/useless_asref.rs:48 :20
14+ --> $DIR/useless_asref.rs:50 :20
1515 |
1616LL | foo_rslice(rslice.as_ref());
1717 | ^^^^^^^^^^^^^^^ help: try: `rslice`
1818
1919error: this call to `as_mut` does nothing
20- --> $DIR/useless_asref.rs:52 :21
20+ --> $DIR/useless_asref.rs:54 :21
2121 |
2222LL | foo_mrslice(mrslice.as_mut());
2323 | ^^^^^^^^^^^^^^^^ help: try: `mrslice`
2424
2525error: this call to `as_ref` does nothing
26- --> $DIR/useless_asref.rs:54 :20
26+ --> $DIR/useless_asref.rs:56 :20
2727 |
2828LL | foo_rslice(mrslice.as_ref());
2929 | ^^^^^^^^^^^^^^^^ help: try: `mrslice`
3030
3131error: this call to `as_ref` does nothing
32- --> $DIR/useless_asref.rs:61 :20
32+ --> $DIR/useless_asref.rs:63 :20
3333 |
3434LL | foo_rslice(rrrrrslice.as_ref());
3535 | ^^^^^^^^^^^^^^^^^^^ help: try: `rrrrrslice`
3636
3737error: this call to `as_ref` does nothing
38- --> $DIR/useless_asref.rs:63 :18
38+ --> $DIR/useless_asref.rs:65 :18
3939 |
4040LL | foo_rstr(rrrrrstr.as_ref());
4141 | ^^^^^^^^^^^^^^^^^ help: try: `rrrrrstr`
4242
4343error: this call to `as_mut` does nothing
44- --> $DIR/useless_asref.rs:68 :21
44+ --> $DIR/useless_asref.rs:70 :21
4545 |
4646LL | foo_mrslice(mrrrrrslice.as_mut());
4747 | ^^^^^^^^^^^^^^^^^^^^ help: try: `mrrrrrslice`
4848
4949error: this call to `as_ref` does nothing
50- --> $DIR/useless_asref.rs:70 :20
50+ --> $DIR/useless_asref.rs:72 :20
5151 |
5252LL | foo_rslice(mrrrrrslice.as_ref());
5353 | ^^^^^^^^^^^^^^^^^^^^ help: try: `mrrrrrslice`
5454
5555error: this call to `as_ref` does nothing
56- --> $DIR/useless_asref.rs:74 :16
56+ --> $DIR/useless_asref.rs:76 :16
5757 |
5858LL | foo_rrrrmr((&&&&MoreRef).as_ref());
5959 | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&&&&MoreRef)`
6060
6161error: this call to `as_mut` does nothing
62- --> $DIR/useless_asref.rs:124 :13
62+ --> $DIR/useless_asref.rs:126 :13
6363 |
6464LL | foo_mrt(mrt.as_mut());
6565 | ^^^^^^^^^^^^ help: try: `mrt`
6666
6767error: this call to `as_ref` does nothing
68- --> $DIR/useless_asref.rs:126 :12
68+ --> $DIR/useless_asref.rs:128 :12
6969 |
7070LL | foo_rt(mrt.as_ref());
7171 | ^^^^^^^^^^^^ help: try: `mrt`
7272
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
7575 |
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
7881 |
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() `
8184
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
8487 |
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 ()`
8790
88- error: aborting due to 13 previous errors
91+ error: aborting due to 14 previous errors
8992
0 commit comments