11error: this match expression is unnecessary
2- --> $DIR/needless_match.rs:15 :18
2+ --> $DIR/needless_match.rs:17 :18
33 |
4- LL | let _: i32 = match x {
4+ LL | let _: i32 = match i {
55 | __________________^
66LL | | 0 => 0,
77LL | | 1 => 1,
88LL | | 2 => 2,
9- LL | | _ => x ,
9+ LL | | _ => i ,
1010LL | | };
11- | |_____^ help: replace it with: `x `
11+ | |_____^ help: replace it with: `i `
1212 |
1313 = note: `-D clippy::needless-match` implied by `-D warnings`
1414
1515error: 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
1750 |
1851LL | let _: Choice = match se {
1952 | _____________________^
@@ -25,7 +58,7 @@ LL | | };
2558 | |_____^ help: replace it with: `se`
2659
2760error: this match expression is unnecessary
28- --> $DIR/needless_match.rs:46 :26
61+ --> $DIR/needless_match.rs:65 :26
2962 |
3063LL | let _: Option<i32> = match x {
3164 | __________________________^
@@ -35,7 +68,7 @@ LL | | };
3568 | |_____^ help: replace it with: `x`
3669
3770error: this match expression is unnecessary
38- --> $DIR/needless_match.rs:62 :31
71+ --> $DIR/needless_match.rs:81 :31
3972 |
4073LL | let _: Result<i32, i32> = match Ok(1) {
4174 | _______________________________^
@@ -45,7 +78,7 @@ LL | | };
4578 | |_____^ help: replace it with: `Ok(1)`
4679
4780error: this match expression is unnecessary
48- --> $DIR/needless_match.rs:66 :31
81+ --> $DIR/needless_match.rs:85 :31
4982 |
5083LL | let _: Result<i32, i32> = match func_ret_err(0_i32) {
5184 | _______________________________^
@@ -55,25 +88,25 @@ LL | | };
5588 | |_____^ help: replace it with: `func_ret_err(0_i32)`
5689
5790error: this if-let expression is unnecessary
58- --> $DIR/needless_match.rs:73 :5
91+ --> $DIR/needless_match.rs:92 :5
5992 |
6093LL | if let Some(a) = Some(1) { Some(a) } else { None }
6194 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `Some(1)`
6295
6396error: this if-let expression is unnecessary
64- --> $DIR/needless_match.rs:77 :30
97+ --> $DIR/needless_match.rs:96 :30
6598 |
6699LL | let _: Result<(), i32> = if let Err(e) = x { Err(e) } else { x };
67100 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
68101
69102error: this if-let expression is unnecessary
70- --> $DIR/needless_match.rs:78 :30
103+ --> $DIR/needless_match.rs:97 :30
71104 |
72105LL | let _: Result<(), i32> = if let Ok(val) = x { Ok(val) } else { x };
73106 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
74107
75108error: this if-let expression is unnecessary
76- --> $DIR/needless_match.rs:84 :21
109+ --> $DIR/needless_match.rs:103 :21
77110 |
78111LL | let _: Choice = if let Choice::A = x {
79112 | _____________________^
@@ -85,5 +118,5 @@ LL | | x
85118LL | | };
86119 | |_____^ help: replace it with: `x`
87120
88- error: aborting due to 9 previous errors
121+ error: aborting due to 12 previous errors
89122
0 commit comments