mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-14 00:47:16 +00:00
134 lines
4.1 KiB
Text
134 lines
4.1 KiB
Text
error: this match expression is unnecessary
|
|
--> $DIR/needless_match.rs:16:18
|
|
|
|
|
LL | let _: i32 = match i {
|
|
| __________________^
|
|
LL | | 0 => 0,
|
|
LL | | 1 => 1,
|
|
LL | | 2 => 2,
|
|
LL | | _ => i,
|
|
LL | | };
|
|
| |_____^ help: replace it with: `i`
|
|
|
|
|
= note: `-D clippy::needless-match` implied by `-D warnings`
|
|
|
|
error: this match expression is unnecessary
|
|
--> $DIR/needless_match.rs:23: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:32:21
|
|
|
|
|
LL | let _: Simple = match se {
|
|
| _____________________^
|
|
LL | | Simple::A => Simple::A,
|
|
LL | | Simple::B => Simple::B,
|
|
LL | | Simple::C => Simple::C,
|
|
LL | | Simple::D => Simple::D,
|
|
LL | | };
|
|
| |_____^ help: replace it with: `se`
|
|
|
|
error: this match expression is unnecessary
|
|
--> $DIR/needless_match.rs:54:26
|
|
|
|
|
LL | let _: Option<i32> = match x {
|
|
| __________________________^
|
|
LL | | Some(a) => Some(a),
|
|
LL | | None => None,
|
|
LL | | };
|
|
| |_____^ help: replace it with: `x`
|
|
|
|
error: this match expression is unnecessary
|
|
--> $DIR/needless_match.rs:70:31
|
|
|
|
|
LL | let _: Result<i32, i32> = match Ok(1) {
|
|
| _______________________________^
|
|
LL | | Ok(a) => Ok(a),
|
|
LL | | Err(err) => Err(err),
|
|
LL | | };
|
|
| |_____^ help: replace it with: `Ok(1)`
|
|
|
|
error: this match expression is unnecessary
|
|
--> $DIR/needless_match.rs:74:31
|
|
|
|
|
LL | let _: Result<i32, i32> = match func_ret_err(0_i32) {
|
|
| _______________________________^
|
|
LL | | Err(err) => Err(err),
|
|
LL | | Ok(a) => Ok(a),
|
|
LL | | };
|
|
| |_____^ help: replace it with: `func_ret_err(0_i32)`
|
|
|
|
error: this if-let expression is unnecessary
|
|
--> $DIR/needless_match.rs:87:13
|
|
|
|
|
LL | let _ = if let Some(a) = Some(1) { Some(a) } else { None };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `Some(1)`
|
|
|
|
error: this if-let expression is unnecessary
|
|
--> $DIR/needless_match.rs:122:31
|
|
|
|
|
LL | let _: Result<i32, i32> = if let Err(e) = x { Err(e) } else { x };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
|
|
|
|
error: this if-let expression is unnecessary
|
|
--> $DIR/needless_match.rs:123:31
|
|
|
|
|
LL | let _: Result<i32, i32> = if let Ok(val) = x { Ok(val) } else { x };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
|
|
|
|
error: this if-let expression is unnecessary
|
|
--> $DIR/needless_match.rs:130:21
|
|
|
|
|
LL | let _: Simple = if let Simple::A = x {
|
|
| _____________________^
|
|
LL | | Simple::A
|
|
LL | | } else if let Simple::B = x {
|
|
LL | | Simple::B
|
|
... |
|
|
LL | | x
|
|
LL | | };
|
|
| |_____^ help: replace it with: `x`
|
|
|
|
error: this match expression is unnecessary
|
|
--> $DIR/needless_match.rs:169:26
|
|
|
|
|
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`
|
|
|
|
error: this match expression is unnecessary
|
|
--> $DIR/needless_match.rs:253:17
|
|
|
|
|
LL | let _ = match e {
|
|
| _________________^
|
|
LL | | _ if some_bool => e,
|
|
LL | | _ => e,
|
|
LL | | };
|
|
| |_________^ help: replace it with: `e`
|
|
|
|
error: this match expression is unnecessary
|
|
--> $DIR/needless_match.rs:259:17
|
|
|
|
|
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
|
|
|