Skip to content

Commit

Permalink
Account for let_chains in collapsible_if ui test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Jun 23, 2019
1 parent b918594 commit 6ef8b57
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/ui/collapsible_if.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,25 @@ else {
println!("Hello world!");
}
}

// Test behavior wrt. `let_chains`.
// None of the cases below should be collapsed.
fn truth() -> bool { true }

// Prefix:
if let 0 = 1 {
if truth() {}
}

// Suffix:
if truth() {
if let 0 = 1 {}
}

// Midfix:
if truth() {
if let 0 = 1 {
if truth() {}
}
}
}
21 changes: 21 additions & 0 deletions tests/ui/collapsible_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,25 @@ fn main() {
println!("Hello world!");
}
}

// Test behavior wrt. `let_chains`.
// None of the cases below should be collapsed.
fn truth() -> bool { true }

// Prefix:
if let 0 = 1 {
if truth() {}
}

// Suffix:
if truth() {
if let 0 = 1 {}
}

// Midfix:
if truth() {
if let 0 = 1 {
if truth() {}
}
}
}

0 comments on commit 6ef8b57

Please sign in to comment.