Skip to content

Commit 6ef8b57

Browse files
committed
Account for let_chains in collapsible_if ui test cases.
1 parent b918594 commit 6ef8b57

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

tests/ui/collapsible_if.fixed

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,25 @@ else {
172172
println!("Hello world!");
173173
}
174174
}
175+
176+
// Test behavior wrt. `let_chains`.
177+
// None of the cases below should be collapsed.
178+
fn truth() -> bool { true }
179+
180+
// Prefix:
181+
if let 0 = 1 {
182+
if truth() {}
183+
}
184+
185+
// Suffix:
186+
if truth() {
187+
if let 0 = 1 {}
188+
}
189+
190+
// Midfix:
191+
if truth() {
192+
if let 0 = 1 {
193+
if truth() {}
194+
}
195+
}
175196
}

tests/ui/collapsible_if.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,25 @@ fn main() {
200200
println!("Hello world!");
201201
}
202202
}
203+
204+
// Test behavior wrt. `let_chains`.
205+
// None of the cases below should be collapsed.
206+
fn truth() -> bool { true }
207+
208+
// Prefix:
209+
if let 0 = 1 {
210+
if truth() {}
211+
}
212+
213+
// Suffix:
214+
if truth() {
215+
if let 0 = 1 {}
216+
}
217+
218+
// Midfix:
219+
if truth() {
220+
if let 0 = 1 {
221+
if truth() {}
222+
}
223+
}
203224
}

0 commit comments

Comments
 (0)