Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/typing.rs')
| -rw-r--r-- | crates/ide/src/typing.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs index b4a2dc28bb..b8856882ed 100644 --- a/crates/ide/src/typing.rs +++ b/crates/ide/src/typing.rs @@ -359,19 +359,16 @@ fn on_left_angle_typed(file: &SourceFile, offset: TextSize) -> Option<ExtendedTe } } - if ancestors_at_offset(file.syntax(), offset) - .find(|n| { - ast::GenericParamList::can_cast(n.kind()) || ast::GenericArgList::can_cast(n.kind()) - }) - .is_some() - { - return Some(ExtendedTextEdit { + if ancestors_at_offset(file.syntax(), offset).any(|n| { + ast::GenericParamList::can_cast(n.kind()) || ast::GenericArgList::can_cast(n.kind()) + }) { + Some(ExtendedTextEdit { edit: TextEdit::replace(range, "<$0>".to_string()), is_snippet: true, - }); + }) + } else { + None } - - None } /// Adds a space after an arrow when `fn foo() { ... }` is turned into `fn foo() -> { ... }` |