mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
70 lines
2.2 KiB
Text
70 lines
2.2 KiB
Text
error: you don't need to add `&` to all patterns
|
|
--> $DIR/match_ref_pats.rs:8:9
|
|
|
|
|
LL | / match v {
|
|
LL | | &Some(v) => println!("{:?}", v),
|
|
LL | | &None => println!("none"),
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
= note: `-D clippy::match-ref-pats` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::match_ref_pats)]`
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
LL ~ match *v {
|
|
LL ~ Some(v) => println!("{:?}", v),
|
|
LL ~ None => println!("none"),
|
|
|
|
|
|
|
error: you don't need to add `&` to both the expression and the patterns
|
|
--> $DIR/match_ref_pats.rs:25:5
|
|
|
|
|
LL | / match &w {
|
|
LL | | &Some(v) => println!("{:?}", v),
|
|
LL | | &None => println!("none"),
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: try
|
|
|
|
|
LL ~ match w {
|
|
LL ~ Some(v) => println!("{:?}", v),
|
|
LL ~ None => println!("none"),
|
|
|
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> $DIR/match_ref_pats.rs:37:12
|
|
|
|
|
LL | if let &None = a {
|
|
| -------^^^^^---- help: try: `if a.is_none()`
|
|
|
|
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> $DIR/match_ref_pats.rs:42:12
|
|
|
|
|
LL | if let &None = &b {
|
|
| -------^^^^^----- help: try: `if b.is_none()`
|
|
|
|
error: you don't need to add `&` to all patterns
|
|
--> $DIR/match_ref_pats.rs:102:9
|
|
|
|
|
LL | / match foobar_variant!(0) {
|
|
LL | | &FooBar::Foo => println!("Foo"),
|
|
LL | | &FooBar::Bar => println!("Bar"),
|
|
LL | | &FooBar::FooBar => println!("FooBar"),
|
|
LL | | _ => println!("Wild"),
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: instead of prefixing all patterns with `&`, you can dereference the expression
|
|
|
|
|
LL ~ match *foobar_variant!(0) {
|
|
LL ~ FooBar::Foo => println!("Foo"),
|
|
LL ~ FooBar::Bar => println!("Bar"),
|
|
LL ~ FooBar::FooBar => println!("FooBar"),
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
|
|