11error: `if` chain can be rewritten with `match`
2- --> tests/ui/comparison_chain.rs:14 :5
2+ --> tests/ui/comparison_chain.rs:15 :5
33 |
44LL | / if x > y {
55LL | |
66LL | | a()
77LL | | } else if x < y {
88LL | | b()
99LL | | }
10- | |_____^
10+ | |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
1111 |
12- = help: consider rewriting the `if` chain to use `cmp` and `match`
1312 = note: `-D clippy::comparison-chain` implied by `-D warnings`
1413 = help: to override `-D warnings` add `#[allow(clippy::comparison_chain)]`
1514
1615error: `if` chain can be rewritten with `match`
17- --> tests/ui/comparison_chain.rs:28 :5
16+ --> tests/ui/comparison_chain.rs:29 :5
1817 |
1918LL | / if x > y {
2019LL | |
@@ -23,12 +22,10 @@ LL | | } else if x < y {
2322... |
2423LL | | c()
2524LL | | }
26- | |_____^
27- |
28- = help: consider rewriting the `if` chain to use `cmp` and `match`
25+ | |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
2926
3027error: `if` chain can be rewritten with `match`
31- --> tests/ui/comparison_chain.rs:37 :5
28+ --> tests/ui/comparison_chain.rs:38 :5
3229 |
3330LL | / if x > y {
3431LL | |
@@ -37,12 +34,10 @@ LL | | } else if y > x {
3734... |
3835LL | | c()
3936LL | | }
40- | |_____^
41- |
42- = help: consider rewriting the `if` chain to use `cmp` and `match`
37+ | |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
4338
4439error: `if` chain can be rewritten with `match`
45- --> tests/ui/comparison_chain.rs:46 :5
40+ --> tests/ui/comparison_chain.rs:47 :5
4641 |
4742LL | / if x > 1 {
4843LL | |
@@ -51,25 +46,21 @@ LL | | } else if x < 1 {
5146... |
5247LL | | c()
5348LL | | }
54- | |_____^
55- |
56- = help: consider rewriting the `if` chain to use `cmp` and `match`
49+ | |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&1) {...}`
5750
5851error: `if` chain can be rewritten with `match`
59- --> tests/ui/comparison_chain.rs:121 :5
52+ --> tests/ui/comparison_chain.rs:122 :5
6053 |
6154LL | / if x > y {
6255LL | |
6356LL | | a()
6457LL | | } else if x < y {
6558LL | | b()
6659LL | | }
67- | |_____^
68- |
69- = help: consider rewriting the `if` chain to use `cmp` and `match`
60+ | |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
7061
7162error: `if` chain can be rewritten with `match`
72- --> tests/ui/comparison_chain.rs:128 :5
63+ --> tests/ui/comparison_chain.rs:129 :5
7364 |
7465LL | / if x > y {
7566LL | |
@@ -78,12 +69,10 @@ LL | | } else if x < y {
7869... |
7970LL | | c()
8071LL | | }
81- | |_____^
82- |
83- = help: consider rewriting the `if` chain to use `cmp` and `match`
72+ | |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
8473
8574error: `if` chain can be rewritten with `match`
86- --> tests/ui/comparison_chain.rs:137 :5
75+ --> tests/ui/comparison_chain.rs:138 :5
8776 |
8877LL | / if x > y {
8978LL | |
@@ -92,9 +81,19 @@ LL | | } else if y > x {
9281... |
9382LL | | c()
9483LL | | }
95- | |_____^
84+ | |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
85+
86+ error: `if` chain can be rewritten with `match`
87+ --> tests/ui/comparison_chain.rs:244:5
9688 |
97- = help: consider rewriting the `if` chain to use `cmp` and `match`
89+ LL | / if x + 1 > y * 2 {
90+ LL | |
91+ LL | | "aa"
92+ LL | | } else if x + 1 < y * 2 {
93+ ... |
94+ LL | | "cc"
95+ LL | | }
96+ | |_____^ help: consider rewriting the `if` chain with `match`: `match (x + 1).cmp(&(y * 2)) {...}`
9897
99- error: aborting due to 7 previous errors
98+ error: aborting due to 8 previous errors
10099
0 commit comments