fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
4.2 KiB135 linesraw
1error: this match expression is unnecessary
2  --> $DIR/needless_match.rs:15:18
3   |
4LL |       let _: i32 = match i {
5   |  __________________^
6LL | |         0 => 0,
7LL | |         1 => 1,
8LL | |         2 => 2,
9LL | |         _ => i,
10LL | |     };
11   | |_____^ help: replace it with: `i`
12   |
13   = note: `-D clippy::needless-match` implied by `-D warnings`
14   = help: to override `-D warnings` add `#[allow(clippy::needless_match)]`
15
16error: this match expression is unnecessary
17  --> $DIR/needless_match.rs:22:19
18   |
19LL |       let _: &str = match s {
20   |  ___________________^
21LL | |         "a" => "a",
22LL | |         "b" => "b",
23LL | |         s => s,
24LL | |     };
25   | |_____^ help: replace it with: `s`
26
27error: this match expression is unnecessary
28  --> $DIR/needless_match.rs:31:21
29   |
30LL |       let _: Simple = match se {
31   |  _____________________^
32LL | |         Simple::A => Simple::A,
33LL | |         Simple::B => Simple::B,
34LL | |         Simple::C => Simple::C,
35LL | |         Simple::D => Simple::D,
36LL | |     };
37   | |_____^ help: replace it with: `se`
38
39error: this match expression is unnecessary
40  --> $DIR/needless_match.rs:53:26
41   |
42LL |       let _: Option<i32> = match x {
43   |  __________________________^
44LL | |         Some(a) => Some(a),
45LL | |         None => None,
46LL | |     };
47   | |_____^ help: replace it with: `x`
48
49error: this match expression is unnecessary
50  --> $DIR/needless_match.rs:69:31
51   |
52LL |       let _: Result<i32, i32> = match Ok(1) {
53   |  _______________________________^
54LL | |         Ok(a) => Ok(a),
55LL | |         Err(err) => Err(err),
56LL | |     };
57   | |_____^ help: replace it with: `Ok(1)`
58
59error: this match expression is unnecessary
60  --> $DIR/needless_match.rs:73:31
61   |
62LL |       let _: Result<i32, i32> = match func_ret_err(0_i32) {
63   |  _______________________________^
64LL | |         Err(err) => Err(err),
65LL | |         Ok(a) => Ok(a),
66LL | |     };
67   | |_____^ help: replace it with: `func_ret_err(0_i32)`
68
69error: this if-let expression is unnecessary
70  --> $DIR/needless_match.rs:86:13
71   |
72LL |     let _ = if let Some(a) = Some(1) { Some(a) } else { None };
73   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `Some(1)`
74
75error: this if-let expression is unnecessary
76  --> $DIR/needless_match.rs:121:31
77   |
78LL |     let _: Result<i32, i32> = if let Err(e) = x { Err(e) } else { x };
79   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
80
81error: this if-let expression is unnecessary
82  --> $DIR/needless_match.rs:122:31
83   |
84LL |     let _: Result<i32, i32> = if let Ok(val) = x { Ok(val) } else { x };
85   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `x`
86
87error: this if-let expression is unnecessary
88  --> $DIR/needless_match.rs:129:21
89   |
90LL |       let _: Simple = if let Simple::A = x {
91   |  _____________________^
92LL | |         Simple::A
93LL | |     } else if let Simple::B = x {
94LL | |         Simple::B
95...  |
96LL | |         x
97LL | |     };
98   | |_____^ help: replace it with: `x`
99
100error: this match expression is unnecessary
101  --> $DIR/needless_match.rs:168:26
102   |
103LL |           let _: Complex = match ce {
104   |  __________________________^
105LL | |             Complex::A(a) => Complex::A(a),
106LL | |             Complex::B(a, b) => Complex::B(a, b),
107LL | |             Complex::C(a, b, c) => Complex::C(a, b, c),
108LL | |             Complex::D(E::VariantA(ea, eb), b) => Complex::D(E::VariantA(ea, eb), b),
109LL | |             Complex::D(E::VariantB(ea, eb), b) => Complex::D(E::VariantB(ea, eb), b),
110LL | |         };
111   | |_________^ help: replace it with: `ce`
112
113error: this match expression is unnecessary
114  --> $DIR/needless_match.rs:252:17
115   |
116LL |           let _ = match e {
117   |  _________________^
118LL | |             _ if some_bool => e,
119LL | |             _ => e,
120LL | |         };
121   | |_________^ help: replace it with: `e`
122
123error: this match expression is unnecessary
124  --> $DIR/needless_match.rs:258:17
125   |
126LL |           let _ = match e {
127   |  _________________^
128LL | |             Some(i) => Some(i),
129LL | |             _ if some_bool => e,
130LL | |             _ => e,
131LL | |         };
132   | |_________^ help: replace it with: `e`
133
134error: aborting due to 13 previous errors
135