2019-07-17 06:08:26 +00:00
|
|
|
error: you don't need to add `&` to all patterns
|
2021-10-07 09:21:30 +00:00
|
|
|
--> $DIR/match_ref_pats.rs:7:9
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
LL | / match v {
|
|
|
|
LL | | &Some(v) => println!("{:?}", v),
|
|
|
|
LL | | &None => println!("none"),
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::match-ref-pats` implied by `-D warnings`
|
|
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ match *v {
|
|
|
|
LL ~ Some(v) => println!("{:?}", v),
|
|
|
|
LL ~ None => println!("none"),
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: you don't need to add `&` to all patterns
|
2021-10-07 09:21:30 +00:00
|
|
|
--> $DIR/match_ref_pats.rs:18:5
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
LL | / match tup {
|
|
|
|
LL | | &(v, 1) => println!("{}", v),
|
|
|
|
LL | | _ => println!("none"),
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2019-07-17 06:08:26 +00:00
|
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ match *tup {
|
|
|
|
LL ~ (v, 1) => println!("{}", v),
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
error: you don't need to add `&` to both the expression and the patterns
|
2021-10-07 09:21:30 +00:00
|
|
|
--> $DIR/match_ref_pats.rs:24:5
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
LL | / match &w {
|
|
|
|
LL | | &Some(v) => println!("{:?}", v),
|
|
|
|
LL | | &None => println!("none"),
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2019-07-17 06:08:26 +00:00
|
|
|
help: try
|
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ match w {
|
|
|
|
LL ~ Some(v) => println!("{:?}", v),
|
|
|
|
LL ~ None => println!("none"),
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
|
2021-04-08 15:50:13 +00:00
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
2021-10-07 09:21:30 +00:00
|
|
|
--> $DIR/match_ref_pats.rs:36:12
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | if let &None = a {
|
|
|
|
| -------^^^^^---- help: try this: `if a.is_none()`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
|
|
|
|
|
2019-07-17 06:08:26 +00:00
|
|
|
error: you don't need to add `&` to all patterns
|
2021-10-07 09:21:30 +00:00
|
|
|
--> $DIR/match_ref_pats.rs:36:5
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
LL | / if let &None = a {
|
|
|
|
LL | | println!("none");
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2019-07-17 06:08:26 +00:00
|
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
|
|
|
|
LL | if let None = *a {
|
2021-08-11 14:21:33 +00:00
|
|
|
| ~~~~ ~~
|
2019-07-17 06:08:26 +00:00
|
|
|
|
2021-04-08 15:50:13 +00:00
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
2021-10-07 09:21:30 +00:00
|
|
|
--> $DIR/match_ref_pats.rs:41:12
|
2021-04-08 15:50:13 +00:00
|
|
|
|
|
|
|
|
LL | if let &None = &b {
|
|
|
|
| -------^^^^^----- help: try this: `if b.is_none()`
|
|
|
|
|
2019-07-17 06:08:26 +00:00
|
|
|
error: you don't need to add `&` to both the expression and the patterns
|
2021-10-07 09:21:30 +00:00
|
|
|
--> $DIR/match_ref_pats.rs:41:5
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
LL | / if let &None = &b {
|
|
|
|
LL | | println!("none");
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2019-07-17 06:08:26 +00:00
|
|
|
help: try
|
|
|
|
|
|
|
|
|
LL | if let None = b {
|
2021-08-11 14:21:33 +00:00
|
|
|
| ~~~~ ~
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
error: you don't need to add `&` to all patterns
|
2021-10-07 09:21:30 +00:00
|
|
|
--> $DIR/match_ref_pats.rs:68:9
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
LL | / match foo_variant!(0) {
|
|
|
|
LL | | &Foo::A => println!("A"),
|
|
|
|
LL | | _ => println!("Wild"),
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
2019-10-26 19:53:42 +00:00
|
|
|
|
|
2019-07-17 06:08:26 +00:00
|
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
|
2021-08-11 14:21:33 +00:00
|
|
|
LL ~ match *foo_variant!(0) {
|
|
|
|
LL ~ Foo::A => println!("A"),
|
2019-07-17 06:08:26 +00:00
|
|
|
|
|
|
|
|
|
2021-04-08 15:50:13 +00:00
|
|
|
error: aborting due to 8 previous errors
|
2019-07-17 06:08:26 +00:00
|
|
|
|