fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.2 KiB70 linesraw
1error: you don't need to add `&` to all patterns
2  --> $DIR/match_ref_pats.rs:8:9
3   |
4LL | /         match v {
5LL | |             &Some(v) => println!("{:?}", v),
6LL | |             &None => println!("none"),
7LL | |         }
8   | |_________^
9   |
10   = note: `-D clippy::match-ref-pats` implied by `-D warnings`
11   = help: to override `-D warnings` add `#[allow(clippy::match_ref_pats)]`
12help: instead of prefixing all patterns with `&`, you can dereference the expression
13   |
14LL ~         match *v {
15LL ~             Some(v) => println!("{:?}", v),
16LL ~             None => println!("none"),
17   |
18
19error: you don't need to add `&` to both the expression and the patterns
20  --> $DIR/match_ref_pats.rs:25:5
21   |
22LL | /     match &w {
23LL | |         &Some(v) => println!("{:?}", v),
24LL | |         &None => println!("none"),
25LL | |     }
26   | |_____^
27   |
28help: try
29   |
30LL ~     match w {
31LL ~         Some(v) => println!("{:?}", v),
32LL ~         None => println!("none"),
33   |
34
35error: redundant pattern matching, consider using `is_none()`
36  --> $DIR/match_ref_pats.rs:37:12
37   |
38LL |     if let &None = a {
39   |     -------^^^^^---- help: try: `if a.is_none()`
40   |
41   = note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
42   = help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]`
43
44error: redundant pattern matching, consider using `is_none()`
45  --> $DIR/match_ref_pats.rs:42:12
46   |
47LL |     if let &None = &b {
48   |     -------^^^^^----- help: try: `if b.is_none()`
49
50error: you don't need to add `&` to all patterns
51  --> $DIR/match_ref_pats.rs:102:9
52   |
53LL | /         match foobar_variant!(0) {
54LL | |             &FooBar::Foo => println!("Foo"),
55LL | |             &FooBar::Bar => println!("Bar"),
56LL | |             &FooBar::FooBar => println!("FooBar"),
57LL | |             _ => println!("Wild"),
58LL | |         }
59   | |_________^
60   |
61help: instead of prefixing all patterns with `&`, you can dereference the expression
62   |
63LL ~         match *foobar_variant!(0) {
64LL ~             FooBar::Foo => println!("Foo"),
65LL ~             FooBar::Bar => println!("Bar"),
66LL ~             FooBar::FooBar => println!("FooBar"),
67   |
68
69error: aborting due to 5 previous errors
70