2022-03-07 04:12:35 -06:00
|
|
|
error: this match expression is unnecessary
|
2022-03-10 00:46:58 -06:00
|
|
|
--> $DIR/needless_match.rs:17:18
|
2022-03-07 04:12:35 -06:00
|
|
|
|
|
2022-03-10 00:46:58 -06:00
|
|
|
LL | let _: i32 = match i {
|
2022-03-08 03:37:53 -06:00
|
|
|
| __________________^
|
2022-03-07 04:12:35 -06:00
|
|
|
LL | | 0 => 0,
|
|
|
|
LL | | 1 => 1,
|
|
|
|
LL | | 2 => 2,
|
2022-03-10 00:46:58 -06:00
|
|
|
LL | | _ => i,
|
2022-03-08 03:37:53 -06:00
|
|
|
LL | | };
|
2022-03-10 00:46:58 -06:00
|
|
|
| |_____^ help: replace it with: `i`
|
2022-03-07 04:12:35 -06:00
|
|
|
|
|
2022-03-09 19:44:25 -06:00
|
|
|
= note: `-D clippy::needless-match` implied by `-D warnings`
|
2022-03-07 04:12:35 -06:00
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
2022-03-10 00:46:58 -06:00
|
|
|
--> $DIR/needless_match.rs:23:18
|
|
|
|
|
|
|
|
|
LL | let _: i32 = match i {
|
|
|
|
| __________________^
|
|
|
|
LL | | 0 => 0,
|
|
|
|
LL | | 1 => 1,
|
|
|
|
LL | | ref i => *i,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace it with: `i`
|
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
|
|
|
--> $DIR/needless_match.rs:28:22
|
|
|
|
|
|
|
|
|
LL | let mut _i_mut = match i {
|
|
|
|
| ______________________^
|
|
|
|
LL | | 0 => 0,
|
|
|
|
LL | | 1 => 1,
|
|
|
|
LL | | ref mut i => *i,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace it with: `i`
|
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
|
|
|
--> $DIR/needless_match.rs:35:19
|
|
|
|
|
|
|
|
|
LL | let _: &str = match s {
|
|
|
|
| ___________________^
|
|
|
|
LL | | "a" => "a",
|
|
|
|
LL | | "b" => "b",
|
|
|
|
LL | | s => s,
|
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace it with: `s`
|
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
|
|
|
--> $DIR/needless_match.rs:43:21
|
2022-03-07 04:12:35 -06:00
|
|
|
|
|
2022-03-08 03:37:53 -06:00
|
|
|
LL | let _: Choice = match se {
|
|
|
|
| _____________________^
|
|
|
|
LL | | Choice::A => Choice::A,
|
|
|
|
LL | | Choice::B => Choice::B,
|
|
|
|
LL | | Choice::C => Choice::C,
|
|
|
|
LL | | Choice::D => Choice::D,
|
|
|
|
LL | | };
|
2022-03-07 04:12:35 -06:00
|
|
|
| |_____^ help: replace it with: `se`
|
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
2022-03-10 00:46:58 -06:00
|
|
|
--> $DIR/needless_match.rs:65:26
|
2022-03-07 04:12:35 -06:00
|
|
|
|
|
2022-03-08 03:37:53 -06:00
|
|
|
LL | let _: Option<i32> = match x {
|
|
|
|
| __________________________^
|
2022-03-07 04:12:35 -06:00
|
|
|
LL | | Some(a) => Some(a),
|
|
|
|
LL | | None => None,
|
2022-03-08 03:37:53 -06:00
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace it with: `x`
|
2022-03-07 04:12:35 -06:00
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
2022-03-10 00:46:58 -06:00
|
|
|
--> $DIR/needless_match.rs:81:31
|
2022-03-07 04:12:35 -06:00
|
|
|
|
|
2022-03-08 03:37:53 -06:00
|
|
|
LL | let _: Result<i32, i32> = match Ok(1) {
|
|
|
|
| _______________________________^
|
2022-03-07 04:12:35 -06:00
|
|
|
LL | | Ok(a) => Ok(a),
|
|
|
|
LL | | Err(err) => Err(err),
|
2022-03-08 03:37:53 -06:00
|
|
|
LL | | };
|
2022-03-07 04:12:35 -06:00
|
|
|
| |_____^ help: replace it with: `Ok(1)`
|
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
2022-03-10 00:46:58 -06:00
|
|
|
--> $DIR/needless_match.rs:85:31
|
2022-03-07 04:12:35 -06:00
|
|
|
|
|
2022-03-08 03:37:53 -06:00
|
|
|
LL | let _: Result<i32, i32> = match func_ret_err(0_i32) {
|
|
|
|
| _______________________________^
|
2022-03-07 04:12:35 -06:00
|
|
|
LL | | Err(err) => Err(err),
|
2022-03-08 03:37:53 -06:00
|
|
|
LL | | Ok(a) => Ok(a),
|
2022-03-07 04:12:35 -06:00
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace it with: `func_ret_err(0_i32)`
|
|
|
|
|
2022-03-08 03:37:53 -06:00
|
|
|
error: this if-let expression is unnecessary
|
2022-03-10 00:46:58 -06:00
|
|
|
--> $DIR/needless_match.rs:92:5
|
2022-03-08 03:37:53 -06:00
|
|
|
|
|
|
|
|
LL | if let Some(a) = Some(1) { Some(a) } else { None }
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `Some(1)`
|
|
|
|
|
|
|
|
error: this if-let expression is unnecessary
|
2022-03-10 00:46:58 -06:00
|
|
|
--> $DIR/needless_match.rs:96:30
|
2022-03-08 03:37:53 -06:00
|
|
|
|
|
|
|
|
LL | let _: Result<(), i32> = if let Err(e) = x { Err(e) } else { x };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
|
|
|
|
|
|
|
|
error: this if-let expression is unnecessary
|
2022-03-10 00:46:58 -06:00
|
|
|
--> $DIR/needless_match.rs:97:30
|
2022-03-08 03:37:53 -06:00
|
|
|
|
|
|
|
|
LL | let _: Result<(), i32> = if let Ok(val) = x { Ok(val) } else { x };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
|
|
|
|
|
|
|
|
error: this if-let expression is unnecessary
|
2022-03-10 00:46:58 -06:00
|
|
|
--> $DIR/needless_match.rs:103:21
|
2022-03-08 03:37:53 -06:00
|
|
|
|
|
2022-03-08 04:15:11 -06:00
|
|
|
LL | let _: Choice = if let Choice::A = x {
|
|
|
|
| _____________________^
|
2022-03-08 03:37:53 -06:00
|
|
|
LL | | Choice::A
|
|
|
|
LL | | } else if let Choice::B = x {
|
|
|
|
LL | | Choice::B
|
|
|
|
... |
|
|
|
|
LL | | x
|
2022-03-08 04:15:11 -06:00
|
|
|
LL | | };
|
2022-03-08 03:37:53 -06:00
|
|
|
| |_____^ help: replace it with: `x`
|
|
|
|
|
2022-03-10 00:46:58 -06:00
|
|
|
error: aborting due to 12 previous errors
|
2022-03-07 04:12:35 -06:00
|
|
|
|