1
1
error: this pattern matching can be expressed using equality
2
- --> tests/ui/equatable_if_let.rs:64 :8
2
+ --> tests/ui/equatable_if_let.rs:65 :8
3
3
|
4
4
LL | if let 2 = a {}
5
5
| ^^^^^^^^^ help: try: `a == 2`
@@ -8,106 +8,124 @@ LL | if let 2 = a {}
8
8
= help: to override `-D warnings` add `#[allow(clippy::equatable_if_let)]`
9
9
10
10
error: this pattern matching can be expressed using equality
11
- --> tests/ui/equatable_if_let.rs:66 :8
11
+ --> tests/ui/equatable_if_let.rs:67 :8
12
12
|
13
13
LL | if let Ordering::Greater = a.cmp(&b) {}
14
14
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `a.cmp(&b) == Ordering::Greater`
15
15
16
16
error: this pattern matching can be expressed using equality
17
- --> tests/ui/equatable_if_let.rs:68 :8
17
+ --> tests/ui/equatable_if_let.rs:69 :8
18
18
|
19
19
LL | if let Some(2) = c {}
20
20
| ^^^^^^^^^^^^^^^ help: try: `c == Some(2)`
21
21
22
22
error: this pattern matching can be expressed using equality
23
- --> tests/ui/equatable_if_let.rs:70 :8
23
+ --> tests/ui/equatable_if_let.rs:71 :8
24
24
|
25
25
LL | if let Struct { a: 2, b: false } = d {}
26
26
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `d == (Struct { a: 2, b: false })`
27
27
28
28
error: this pattern matching can be expressed using equality
29
- --> tests/ui/equatable_if_let.rs:72 :8
29
+ --> tests/ui/equatable_if_let.rs:73 :8
30
30
|
31
31
LL | if let Enum::TupleVariant(32, 64) = e {}
32
32
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `e == Enum::TupleVariant(32, 64)`
33
33
34
34
error: this pattern matching can be expressed using equality
35
- --> tests/ui/equatable_if_let.rs:74 :8
35
+ --> tests/ui/equatable_if_let.rs:75 :8
36
36
|
37
37
LL | if let Enum::RecordVariant { a: 64, b: 32 } = e {}
38
38
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `e == (Enum::RecordVariant { a: 64, b: 32 })`
39
39
40
40
error: this pattern matching can be expressed using equality
41
- --> tests/ui/equatable_if_let.rs:76 :8
41
+ --> tests/ui/equatable_if_let.rs:77 :8
42
42
|
43
43
LL | if let Enum::UnitVariant = e {}
44
44
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `e == Enum::UnitVariant`
45
45
46
46
error: this pattern matching can be expressed using equality
47
- --> tests/ui/equatable_if_let.rs:78 :8
47
+ --> tests/ui/equatable_if_let.rs:79 :8
48
48
|
49
49
LL | if let (Enum::UnitVariant, &Struct { a: 2, b: false }) = (e, &d) {}
50
50
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(e, &d) == (Enum::UnitVariant, &Struct { a: 2, b: false })`
51
51
52
52
error: this pattern matching can be expressed using `matches!`
53
- --> tests/ui/equatable_if_let.rs:88 :8
53
+ --> tests/ui/equatable_if_let.rs:89 :8
54
54
|
55
55
LL | if let NotPartialEq::A = f {}
56
56
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(f, NotPartialEq::A)`
57
57
58
58
error: this pattern matching can be expressed using equality
59
- --> tests/ui/equatable_if_let.rs:90 :8
59
+ --> tests/ui/equatable_if_let.rs:91 :8
60
60
|
61
61
LL | if let NotStructuralEq::A = g {}
62
62
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `g == NotStructuralEq::A`
63
63
64
64
error: this pattern matching can be expressed using `matches!`
65
- --> tests/ui/equatable_if_let.rs:92 :8
65
+ --> tests/ui/equatable_if_let.rs:93 :8
66
66
|
67
67
LL | if let Some(NotPartialEq::A) = Some(f) {}
68
68
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(Some(f), Some(NotPartialEq::A))`
69
69
70
70
error: this pattern matching can be expressed using equality
71
- --> tests/ui/equatable_if_let.rs:94 :8
71
+ --> tests/ui/equatable_if_let.rs:95 :8
72
72
|
73
73
LL | if let Some(NotStructuralEq::A) = Some(g) {}
74
74
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(g) == Some(NotStructuralEq::A)`
75
75
76
76
error: this pattern matching can be expressed using `matches!`
77
- --> tests/ui/equatable_if_let.rs:96 :8
77
+ --> tests/ui/equatable_if_let.rs:97 :8
78
78
|
79
79
LL | if let NoPartialEqStruct { a: 2, b: false } = h {}
80
80
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(h, NoPartialEqStruct { a: 2, b: false })`
81
81
82
82
error: this pattern matching can be expressed using equality
83
- --> tests/ui/equatable_if_let.rs:99 :8
83
+ --> tests/ui/equatable_if_let.rs:100 :8
84
84
|
85
85
LL | if let inline!("abc") = "abc" {
86
86
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"abc" == inline!("abc")`
87
87
88
88
error: this pattern matching can be expressed using `matches!`
89
- --> tests/ui/equatable_if_let.rs:109 :12
89
+ --> tests/ui/equatable_if_let.rs:110 :12
90
90
|
91
91
LL | if let Some('i') = cs.iter().next() {
92
92
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(cs.iter().next(), Some('i'))`
93
93
94
94
error: this pattern matching can be expressed using `matches!`
95
- --> tests/ui/equatable_if_let.rs:117 :12
95
+ --> tests/ui/equatable_if_let.rs:118 :12
96
96
|
97
97
LL | if let Some(1) = cs.iter().next() {
98
98
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(cs.iter().next(), Some(1))`
99
99
100
100
error: this pattern matching can be expressed using `matches!`
101
- --> tests/ui/equatable_if_let.rs:135 :12
101
+ --> tests/ui/equatable_if_let.rs:136 :12
102
102
|
103
103
LL | if let Some(MyEnum::B) = get_enum() {
104
104
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(get_enum(), Some(MyEnum::B))`
105
105
106
106
error: this pattern matching can be expressed using `matches!`
107
- --> tests/ui/equatable_if_let.rs:145 :23
107
+ --> tests/ui/equatable_if_let.rs:154 :23
108
108
|
109
- LL | const _: u32 = if let Some(true) = None { 0 } else { 1 };
110
- | ^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(None, Some(true) )`
109
+ LL | const _: u32 = if let NonConstEq = NonConstEq { 0 } else { 1 };
110
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `matches!(NonConstEq, NonConstEq )`
111
111
112
- error: aborting due to 18 previous errors
112
+ error: this pattern matching can be expressed using equality
113
+ --> tests/ui/equatable_if_let.rs:156:23
114
+ |
115
+ LL | const _: u32 = if let Some(NonConstEq) = None { 0 } else { 1 };
116
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `None == Some(NonConstEq)`
117
+
118
+ error: this pattern matching can be expressed using equality
119
+ --> tests/ui/equatable_if_let.rs:167:23
120
+ |
121
+ LL | const _: u32 = if let ConstEq = ConstEq { 0 } else { 1 };
122
+ | ^^^^^^^^^^^^^^^^^^^^^ help: try: `ConstEq == ConstEq`
123
+
124
+ error: this pattern matching can be expressed using equality
125
+ --> tests/ui/equatable_if_let.rs:169:23
126
+ |
127
+ LL | const _: u32 = if let Some(ConstEq) = None { 0 } else { 1 };
128
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `None == Some(ConstEq)`
129
+
130
+ error: aborting due to 21 previous errors
113
131
0 commit comments