1
1
error: this match expression is unnecessary
2
- --> $DIR/needless_match.rs:15 :18
2
+ --> $DIR/needless_match.rs:17 :18
3
3
|
4
- LL | let _: i32 = match x {
4
+ LL | let _: i32 = match i {
5
5
| __________________^
6
6
LL | | 0 => 0,
7
7
LL | | 1 => 1,
8
8
LL | | 2 => 2,
9
- LL | | _ => x ,
9
+ LL | | _ => i ,
10
10
LL | | };
11
- | |_____^ help: replace it with: `x `
11
+ | |_____^ help: replace it with: `i `
12
12
|
13
13
= note: `-D clippy::needless-match` implied by `-D warnings`
14
14
15
15
error: this match expression is unnecessary
16
- --> $DIR/needless_match.rs:24:21
16
+ --> $DIR/needless_match.rs:23:18
17
+ |
18
+ LL | let _: i32 = match i {
19
+ | __________________^
20
+ LL | | 0 => 0,
21
+ LL | | 1 => 1,
22
+ LL | | ref i => *i,
23
+ LL | | };
24
+ | |_____^ help: replace it with: `i`
25
+
26
+ error: this match expression is unnecessary
27
+ --> $DIR/needless_match.rs:28:22
28
+ |
29
+ LL | let mut _i_mut = match i {
30
+ | ______________________^
31
+ LL | | 0 => 0,
32
+ LL | | 1 => 1,
33
+ LL | | ref mut i => *i,
34
+ LL | | };
35
+ | |_____^ help: replace it with: `i`
36
+
37
+ error: this match expression is unnecessary
38
+ --> $DIR/needless_match.rs:35:19
39
+ |
40
+ LL | let _: &str = match s {
41
+ | ___________________^
42
+ LL | | "a" => "a",
43
+ LL | | "b" => "b",
44
+ LL | | s => s,
45
+ LL | | };
46
+ | |_____^ help: replace it with: `s`
47
+
48
+ error: this match expression is unnecessary
49
+ --> $DIR/needless_match.rs:43:21
17
50
|
18
51
LL | let _: Choice = match se {
19
52
| _____________________^
@@ -25,7 +58,7 @@ LL | | };
25
58
| |_____^ help: replace it with: `se`
26
59
27
60
error: this match expression is unnecessary
28
- --> $DIR/needless_match.rs:46 :26
61
+ --> $DIR/needless_match.rs:65 :26
29
62
|
30
63
LL | let _: Option<i32> = match x {
31
64
| __________________________^
@@ -35,7 +68,7 @@ LL | | };
35
68
| |_____^ help: replace it with: `x`
36
69
37
70
error: this match expression is unnecessary
38
- --> $DIR/needless_match.rs:62 :31
71
+ --> $DIR/needless_match.rs:81 :31
39
72
|
40
73
LL | let _: Result<i32, i32> = match Ok(1) {
41
74
| _______________________________^
@@ -45,7 +78,7 @@ LL | | };
45
78
| |_____^ help: replace it with: `Ok(1)`
46
79
47
80
error: this match expression is unnecessary
48
- --> $DIR/needless_match.rs:66 :31
81
+ --> $DIR/needless_match.rs:85 :31
49
82
|
50
83
LL | let _: Result<i32, i32> = match func_ret_err(0_i32) {
51
84
| _______________________________^
@@ -55,25 +88,25 @@ LL | | };
55
88
| |_____^ help: replace it with: `func_ret_err(0_i32)`
56
89
57
90
error: this if-let expression is unnecessary
58
- --> $DIR/needless_match.rs:73 :5
91
+ --> $DIR/needless_match.rs:92 :5
59
92
|
60
93
LL | if let Some(a) = Some(1) { Some(a) } else { None }
61
94
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `Some(1)`
62
95
63
96
error: this if-let expression is unnecessary
64
- --> $DIR/needless_match.rs:77 :30
97
+ --> $DIR/needless_match.rs:96 :30
65
98
|
66
99
LL | let _: Result<(), i32> = if let Err(e) = x { Err(e) } else { x };
67
100
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
68
101
69
102
error: this if-let expression is unnecessary
70
- --> $DIR/needless_match.rs:78 :30
103
+ --> $DIR/needless_match.rs:97 :30
71
104
|
72
105
LL | let _: Result<(), i32> = if let Ok(val) = x { Ok(val) } else { x };
73
106
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
74
107
75
108
error: this if-let expression is unnecessary
76
- --> $DIR/needless_match.rs:84 :21
109
+ --> $DIR/needless_match.rs:103 :21
77
110
|
78
111
LL | let _: Choice = if let Choice::A = x {
79
112
| _____________________^
@@ -85,5 +118,5 @@ LL | | x
85
118
LL | | };
86
119
| |_____^ help: replace it with: `x`
87
120
88
- error: aborting due to 9 previous errors
121
+ error: aborting due to 12 previous errors
89
122
0 commit comments