Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/invert_if.rs')
| -rw-r--r-- | crates/ide-assists/src/handlers/invert_if.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ide-assists/src/handlers/invert_if.rs b/crates/ide-assists/src/handlers/invert_if.rs index 9dda4bbb96..f50ccc3e11 100644 --- a/crates/ide-assists/src/handlers/invert_if.rs +++ b/crates/ide-assists/src/handlers/invert_if.rs @@ -115,6 +115,15 @@ mod tests { } #[test] + fn invert_if_general_case_needs_paren() { + check_assist( + invert_if, + "fn f() { i$0f cond as bool { 3 * 2 } else { 1 } }", + "fn f() { if !(cond as bool) { 1 } else { 3 * 2 } }", + ) + } + + #[test] fn invert_if_on_else_keyword() { check_assist( invert_if, |