99 lines
2.6 KiB
Text
99 lines
2.6 KiB
Text
error: `if` chain can be rewritten with `match`
|
|
--> tests/ui/comparison_chain.rs:15:5
|
|
|
|
|
LL | / if x > y {
|
|
LL | |
|
|
LL | | a()
|
|
LL | | } else if x < y {
|
|
LL | | b()
|
|
LL | | }
|
|
| |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
|
|
|
|
|
= note: `-D clippy::comparison-chain` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::comparison_chain)]`
|
|
|
|
error: `if` chain can be rewritten with `match`
|
|
--> tests/ui/comparison_chain.rs:29:5
|
|
|
|
|
LL | / if x > y {
|
|
LL | |
|
|
LL | | a()
|
|
LL | | } else if x < y {
|
|
... |
|
|
LL | | c()
|
|
LL | | }
|
|
| |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
|
|
|
|
error: `if` chain can be rewritten with `match`
|
|
--> tests/ui/comparison_chain.rs:38:5
|
|
|
|
|
LL | / if x > y {
|
|
LL | |
|
|
LL | | a()
|
|
LL | | } else if y > x {
|
|
... |
|
|
LL | | c()
|
|
LL | | }
|
|
| |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
|
|
|
|
error: `if` chain can be rewritten with `match`
|
|
--> tests/ui/comparison_chain.rs:47:5
|
|
|
|
|
LL | / if x > 1 {
|
|
LL | |
|
|
LL | | a()
|
|
LL | | } else if x < 1 {
|
|
... |
|
|
LL | | c()
|
|
LL | | }
|
|
| |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&1) {...}`
|
|
|
|
error: `if` chain can be rewritten with `match`
|
|
--> tests/ui/comparison_chain.rs:122:5
|
|
|
|
|
LL | / if x > y {
|
|
LL | |
|
|
LL | | a()
|
|
LL | | } else if x < y {
|
|
LL | | b()
|
|
LL | | }
|
|
| |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
|
|
|
|
error: `if` chain can be rewritten with `match`
|
|
--> tests/ui/comparison_chain.rs:129:5
|
|
|
|
|
LL | / if x > y {
|
|
LL | |
|
|
LL | | a()
|
|
LL | | } else if x < y {
|
|
... |
|
|
LL | | c()
|
|
LL | | }
|
|
| |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
|
|
|
|
error: `if` chain can be rewritten with `match`
|
|
--> tests/ui/comparison_chain.rs:138:5
|
|
|
|
|
LL | / if x > y {
|
|
LL | |
|
|
LL | | a()
|
|
LL | | } else if y > x {
|
|
... |
|
|
LL | | c()
|
|
LL | | }
|
|
| |_____^ help: consider rewriting the `if` chain with `match`: `match x.cmp(&y) {...}`
|
|
|
|
error: `if` chain can be rewritten with `match`
|
|
--> tests/ui/comparison_chain.rs:244:5
|
|
|
|
|
LL | / if x + 1 > y * 2 {
|
|
LL | |
|
|
LL | | "aa"
|
|
LL | | } else if x + 1 < y * 2 {
|
|
... |
|
|
LL | | "cc"
|
|
LL | | }
|
|
| |_____^ help: consider rewriting the `if` chain with `match`: `match (x + 1).cmp(&(y * 2)) {...}`
|
|
|
|
error: aborting due to 8 previous errors
|
|
|