rust/tests/ui/ref_binding_to_reference.stderr
Jason Newcomb 6d4dc35882
Improve needless_borrow lint
Suggest changing usages of ref bindings to match the new type
Split out some cases into new lint `ref_binding_to_reference`
2021-05-20 09:03:47 -04:00

89 lines
1.9 KiB
Plaintext

error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:31:14
|
LL | Some(ref x) => x,
| ^^^^^
|
= note: `-D clippy::ref-binding-to-reference` implied by `-D warnings`
help: try this
|
LL | Some(x) => &x,
| ^ ^^
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:37:14
|
LL | Some(ref x) => {
| ^^^^^
|
help: try this
|
LL | Some(x) => {
LL | f1(x);
LL | f1(x);
LL | &x
|
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:47:14
|
LL | Some(ref x) => m2!(x),
| ^^^^^
|
help: try this
|
LL | Some(x) => m2!(&x),
| ^ ^^
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:52:15
|
LL | let _ = |&ref x: &&String| {
| ^^^^^
|
help: try this
|
LL | let _ = |&x: &&String| {
LL | let _: &&String = &x;
|
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:58:12
|
LL | fn f2<'a>(&ref x: &&'a String) -> &'a String {
| ^^^^^
|
help: try this
|
LL | fn f2<'a>(&x: &&'a String) -> &'a String {
LL | let _: &&String = &x;
LL | x
|
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:65:11
|
LL | fn f(&ref x: &&String) {
| ^^^^^
|
help: try this
|
LL | fn f(&x: &&String) {
LL | let _: &&String = &x;
|
error: this pattern creates a reference to a reference
--> $DIR/ref_binding_to_reference.rs:73:11
|
LL | fn f(&ref x: &&String) {
| ^^^^^
|
help: try this
|
LL | fn f(&x: &&String) {
LL | let _: &&String = &x;
|
error: aborting due to 7 previous errors