2022-03-07 10:12:35 +00:00
|
|
|
error: this match expression is unnecessary
|
2022-03-16 08:26:56 +00:00
|
|
|
--> $DIR/needless_match.rs:16:18
|
2022-03-07 10:12:35 +00:00
|
|
|
|
|
2022-03-10 06:46:58 +00:00
|
|
|
LL | let _: i32 = match i {
|
2022-03-08 09:37:53 +00:00
|
|
|
| __________________^
|
2022-03-07 10:12:35 +00:00
|
|
|
LL | | 0 => 0,
|
|
|
|
LL | | 1 => 1,
|
|
|
|
LL | | 2 => 2,
|
2022-03-10 06:46:58 +00:00
|
|
|
LL | | _ => i,
|
2022-03-08 09:37:53 +00:00
|
|
|
LL | | };
|
2022-03-10 06:46:58 +00:00
|
|
|
| |_____^ help: replace it with: `i`
|
2022-03-07 10:12:35 +00:00
|
|
|
|
|
2022-03-10 01:44:25 +00:00
|
|
|
= note: `-D clippy::needless-match` implied by `-D warnings`
|
2022-03-07 10:12:35 +00:00
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
2022-03-16 08:26:56 +00:00
|
|
|
--> $DIR/needless_match.rs:23:19
|
2022-03-10 06:46:58 +00:00
|
|
|
|
|
|
|
|
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
|
2022-03-16 08:26:56 +00:00
|
|
|
--> $DIR/needless_match.rs:32:21
|
2022-03-07 10:12:35 +00:00
|
|
|
|
|
2022-03-16 08:26:56 +00:00
|
|
|
LL | let _: Simple = match se {
|
2022-03-08 09:37:53 +00:00
|
|
|
| _____________________^
|
2022-03-16 08:26:56 +00:00
|
|
|
LL | | Simple::A => Simple::A,
|
|
|
|
LL | | Simple::B => Simple::B,
|
|
|
|
LL | | Simple::C => Simple::C,
|
|
|
|
LL | | Simple::D => Simple::D,
|
2022-03-08 09:37:53 +00:00
|
|
|
LL | | };
|
2022-03-07 10:12:35 +00:00
|
|
|
| |_____^ help: replace it with: `se`
|
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
2022-03-16 08:26:56 +00:00
|
|
|
--> $DIR/needless_match.rs:54:26
|
2022-03-07 10:12:35 +00:00
|
|
|
|
|
2022-03-08 09:37:53 +00:00
|
|
|
LL | let _: Option<i32> = match x {
|
|
|
|
| __________________________^
|
2022-03-07 10:12:35 +00:00
|
|
|
LL | | Some(a) => Some(a),
|
|
|
|
LL | | None => None,
|
2022-03-08 09:37:53 +00:00
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace it with: `x`
|
2022-03-07 10:12:35 +00:00
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
2022-03-16 08:26:56 +00:00
|
|
|
--> $DIR/needless_match.rs:70:31
|
2022-03-07 10:12:35 +00:00
|
|
|
|
|
2022-03-08 09:37:53 +00:00
|
|
|
LL | let _: Result<i32, i32> = match Ok(1) {
|
|
|
|
| _______________________________^
|
2022-03-07 10:12:35 +00:00
|
|
|
LL | | Ok(a) => Ok(a),
|
|
|
|
LL | | Err(err) => Err(err),
|
2022-03-08 09:37:53 +00:00
|
|
|
LL | | };
|
2022-03-07 10:12:35 +00:00
|
|
|
| |_____^ help: replace it with: `Ok(1)`
|
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
2022-03-16 08:26:56 +00:00
|
|
|
--> $DIR/needless_match.rs:74:31
|
2022-03-07 10:12:35 +00:00
|
|
|
|
|
2022-03-08 09:37:53 +00:00
|
|
|
LL | let _: Result<i32, i32> = match func_ret_err(0_i32) {
|
|
|
|
| _______________________________^
|
2022-03-07 10:12:35 +00:00
|
|
|
LL | | Err(err) => Err(err),
|
2022-03-08 09:37:53 +00:00
|
|
|
LL | | Ok(a) => Ok(a),
|
2022-03-07 10:12:35 +00:00
|
|
|
LL | | };
|
|
|
|
| |_____^ help: replace it with: `func_ret_err(0_i32)`
|
|
|
|
|
2022-03-08 09:37:53 +00:00
|
|
|
error: this if-let expression is unnecessary
|
2022-03-17 15:06:31 +00:00
|
|
|
--> $DIR/needless_match.rs:87:13
|
2022-03-08 09:37:53 +00:00
|
|
|
|
|
2022-03-17 15:06:31 +00:00
|
|
|
LL | let _ = if let Some(a) = Some(1) { Some(a) } else { None };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `Some(1)`
|
2022-03-08 09:37:53 +00:00
|
|
|
|
|
|
|
error: this if-let expression is unnecessary
|
2022-04-15 10:33:24 +00:00
|
|
|
--> $DIR/needless_match.rs:122:31
|
2022-03-08 09:37:53 +00:00
|
|
|
|
|
2022-03-16 08:26:56 +00:00
|
|
|
LL | let _: Result<i32, i32> = if let Err(e) = x { Err(e) } else { x };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
|
2022-03-08 09:37:53 +00:00
|
|
|
|
|
|
|
error: this if-let expression is unnecessary
|
2022-04-15 10:33:24 +00:00
|
|
|
--> $DIR/needless_match.rs:123:31
|
2022-03-08 09:37:53 +00:00
|
|
|
|
|
2022-03-16 08:26:56 +00:00
|
|
|
LL | let _: Result<i32, i32> = if let Ok(val) = x { Ok(val) } else { x };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
|
2022-03-08 09:37:53 +00:00
|
|
|
|
|
|
|
error: this if-let expression is unnecessary
|
2022-07-08 16:12:00 +00:00
|
|
|
--> $DIR/needless_match.rs:130:21
|
2022-03-08 09:37:53 +00:00
|
|
|
|
|
2022-03-16 08:26:56 +00:00
|
|
|
LL | let _: Simple = if let Simple::A = x {
|
2022-03-08 10:15:11 +00:00
|
|
|
| _____________________^
|
2022-03-16 08:26:56 +00:00
|
|
|
LL | | Simple::A
|
|
|
|
LL | | } else if let Simple::B = x {
|
|
|
|
LL | | Simple::B
|
2022-03-08 09:37:53 +00:00
|
|
|
... |
|
|
|
|
LL | | x
|
2022-03-08 10:15:11 +00:00
|
|
|
LL | | };
|
2022-03-08 09:37:53 +00:00
|
|
|
| |_____^ help: replace it with: `x`
|
|
|
|
|
2022-03-16 08:26:56 +00:00
|
|
|
error: this match expression is unnecessary
|
2022-07-08 16:12:00 +00:00
|
|
|
--> $DIR/needless_match.rs:169:26
|
2022-03-16 08:26:56 +00:00
|
|
|
|
|
|
|
|
LL | let _: Complex = match ce {
|
|
|
|
| __________________________^
|
|
|
|
LL | | Complex::A(a) => Complex::A(a),
|
|
|
|
LL | | Complex::B(a, b) => Complex::B(a, b),
|
|
|
|
LL | | Complex::C(a, b, c) => Complex::C(a, b, c),
|
|
|
|
LL | | Complex::D(E::VariantA(ea, eb), b) => Complex::D(E::VariantA(ea, eb), b),
|
|
|
|
LL | | Complex::D(E::VariantB(ea, eb), b) => Complex::D(E::VariantB(ea, eb), b),
|
|
|
|
LL | | };
|
|
|
|
| |_________^ help: replace it with: `ce`
|
|
|
|
|
2022-07-02 03:57:57 +00:00
|
|
|
error: this match expression is unnecessary
|
2022-08-21 08:26:39 +00:00
|
|
|
--> $DIR/needless_match.rs:253:17
|
2022-07-02 03:57:57 +00:00
|
|
|
|
|
|
|
|
LL | let _ = match e {
|
|
|
|
| _________________^
|
|
|
|
LL | | _ if some_bool => e,
|
|
|
|
LL | | _ => e,
|
|
|
|
LL | | };
|
|
|
|
| |_________^ help: replace it with: `e`
|
|
|
|
|
|
|
|
error: this match expression is unnecessary
|
2022-08-21 08:26:39 +00:00
|
|
|
--> $DIR/needless_match.rs:259:17
|
2022-07-02 03:57:57 +00:00
|
|
|
|
|
|
|
|
LL | let _ = match e {
|
|
|
|
| _________________^
|
|
|
|
LL | | Some(i) => Some(i),
|
|
|
|
LL | | _ if some_bool => e,
|
|
|
|
LL | | _ => e,
|
|
|
|
LL | | };
|
|
|
|
| |_________^ help: replace it with: `e`
|
|
|
|
|
|
|
|
error: aborting due to 13 previous errors
|
2022-03-07 10:12:35 +00:00
|
|
|
|