1
1
error: `if` chain can be rewritten with `match`
2
- --> tests/ui/comparison_chain.rs:14 :5
2
+ --> tests/ui/comparison_chain.rs:15 :5
3
3
|
4
4
LL | / if x > y {
5
5
LL | |
6
6
LL | | a()
7
7
LL | | } else if x < y {
8
8
LL | | b()
9
9
LL | | }
10
- | |_____^
10
+ | |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
11
11
|
12
- = help: consider rewriting the `if` chain to use `cmp` and `match`
13
12
= note: `-D clippy::comparison-chain` implied by `-D warnings`
14
13
= help: to override `-D warnings` add `#[allow(clippy::comparison_chain)]`
15
14
16
15
error: `if` chain can be rewritten with `match`
17
- --> tests/ui/comparison_chain.rs:28 :5
16
+ --> tests/ui/comparison_chain.rs:29 :5
18
17
|
19
18
LL | / if x > y {
20
19
LL | |
@@ -23,12 +22,10 @@ LL | | } else if x < y {
23
22
... |
24
23
LL | | c()
25
24
LL | | }
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) {...}`
29
26
30
27
error: `if` chain can be rewritten with `match`
31
- --> tests/ui/comparison_chain.rs:37 :5
28
+ --> tests/ui/comparison_chain.rs:38 :5
32
29
|
33
30
LL | / if x > y {
34
31
LL | |
@@ -37,12 +34,10 @@ LL | | } else if y > x {
37
34
... |
38
35
LL | | c()
39
36
LL | | }
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) {...}`
43
38
44
39
error: `if` chain can be rewritten with `match`
45
- --> tests/ui/comparison_chain.rs:46 :5
40
+ --> tests/ui/comparison_chain.rs:47 :5
46
41
|
47
42
LL | / if x > 1 {
48
43
LL | |
@@ -51,25 +46,21 @@ LL | | } else if x < 1 {
51
46
... |
52
47
LL | | c()
53
48
LL | | }
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) {...}`
57
50
58
51
error: `if` chain can be rewritten with `match`
59
- --> tests/ui/comparison_chain.rs:121 :5
52
+ --> tests/ui/comparison_chain.rs:122 :5
60
53
|
61
54
LL | / if x > y {
62
55
LL | |
63
56
LL | | a()
64
57
LL | | } else if x < y {
65
58
LL | | b()
66
59
LL | | }
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) {...}`
70
61
71
62
error: `if` chain can be rewritten with `match`
72
- --> tests/ui/comparison_chain.rs:128 :5
63
+ --> tests/ui/comparison_chain.rs:129 :5
73
64
|
74
65
LL | / if x > y {
75
66
LL | |
@@ -78,12 +69,10 @@ LL | | } else if x < y {
78
69
... |
79
70
LL | | c()
80
71
LL | | }
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) {...}`
84
73
85
74
error: `if` chain can be rewritten with `match`
86
- --> tests/ui/comparison_chain.rs:137 :5
75
+ --> tests/ui/comparison_chain.rs:138 :5
87
76
|
88
77
LL | / if x > y {
89
78
LL | |
@@ -92,9 +81,19 @@ LL | | } else if y > x {
92
81
... |
93
82
LL | | c()
94
83
LL | | }
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
96
88
|
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)) {...}`
98
97
99
- error: aborting due to 7 previous errors
98
+ error: aborting due to 8 previous errors
100
99
0 commit comments