2019-07-17 01:08:26 -05:00
|
|
|
error: you don't need to add `&` to all patterns
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/match_ref_pats.rs:8:9
|
2019-07-17 01:08:26 -05:00
|
|
|
|
|
|
|
|
LL | / match v {
|
|
|
|
LL | | &Some(v) => println!("{:?}", v),
|
|
|
|
LL | | &None => println!("none"),
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::match-ref-pats` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::match_ref_pats)]`
|
2019-07-17 01:08:26 -05:00
|
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ match *v {
|
|
|
|
LL ~ Some(v) => println!("{:?}", v),
|
|
|
|
LL ~ None => println!("none"),
|
2019-07-17 01:08:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
error: you don't need to add `&` to both the expression and the patterns
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/match_ref_pats.rs:25:5
|
2019-07-17 01:08:26 -05:00
|
|
|
|
|
|
|
|
LL | / match &w {
|
|
|
|
LL | | &Some(v) => println!("{:?}", v),
|
|
|
|
LL | | &None => println!("none"),
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2019-10-26 14:53:42 -05:00
|
|
|
|
|
2019-07-17 01:08:26 -05:00
|
|
|
help: try
|
|
|
|
|
|
2021-08-11 09:21:33 -05:00
|
|
|
LL ~ match w {
|
|
|
|
LL ~ Some(v) => println!("{:?}", v),
|
|
|
|
LL ~ None => println!("none"),
|
2019-07-17 01:08:26 -05:00
|
|
|
|
|
|
|
|
|
2021-04-08 10:50:13 -05:00
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/match_ref_pats.rs:37:12
|
2021-04-08 10:50:13 -05:00
|
|
|
|
|
|
|
|
LL | if let &None = a {
|
2023-07-17 03:19:29 -05:00
|
|
|
| -------^^^^^---- help: try: `if a.is_none()`
|
2021-04-08 10:50:13 -05:00
|
|
|
|
|
|
|
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]`
|
2021-04-08 10:50:13 -05:00
|
|
|
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/match_ref_pats.rs:42:12
|
2021-04-08 10:50:13 -05:00
|
|
|
|
|
|
|
|
LL | if let &None = &b {
|
2023-07-17 03:19:29 -05:00
|
|
|
| -------^^^^^----- help: try: `if b.is_none()`
|
2021-04-08 10:50:13 -05:00
|
|
|
|
2019-07-17 01:08:26 -05:00
|
|
|
error: you don't need to add `&` to all patterns
|
2024-02-27 08:25:18 -06:00
|
|
|
--> tests/ui/match_ref_pats.rs:102:9
|
2019-07-17 01:08:26 -05:00
|
|
|
|
|
2021-10-21 06:11:36 -05:00
|
|
|
LL | / match foobar_variant!(0) {
|
|
|
|
LL | | &FooBar::Foo => println!("Foo"),
|
|
|
|
LL | | &FooBar::Bar => println!("Bar"),
|
|
|
|
LL | | &FooBar::FooBar => println!("FooBar"),
|
2019-07-17 01:08:26 -05:00
|
|
|
LL | | _ => println!("Wild"),
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
2019-10-26 14:53:42 -05:00
|
|
|
|
|
2019-07-17 01:08:26 -05:00
|
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
|
2021-10-21 06:11:36 -05:00
|
|
|
LL ~ match *foobar_variant!(0) {
|
|
|
|
LL ~ FooBar::Foo => println!("Foo"),
|
|
|
|
LL ~ FooBar::Bar => println!("Bar"),
|
|
|
|
LL ~ FooBar::FooBar => println!("FooBar"),
|
2019-07-17 01:08:26 -05:00
|
|
|
|
|
|
|
|
|
2021-10-21 06:11:36 -05:00
|
|
|
error: aborting due to 5 previous errors
|
2019-07-17 01:08:26 -05:00
|
|
|
|