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.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs
index c7e403f6b1..27dedab13e 100644
--- a/crates/ide/src/typing.rs
+++ b/crates/ide/src/typing.rs
@@ -86,17 +86,16 @@ fn on_char_typed_inner(
if !stdx::always!(TRIGGER_CHARS.contains(char_typed)) {
return None;
}
- return match char_typed {
+ let conv = |text_edit: Option<TextEdit>| {
+ Some(ExtendedTextEdit { edit: text_edit?, is_snippet: false })
+ };
+ match char_typed {
'.' => conv(on_dot_typed(&file.tree(), offset)),
'=' => conv(on_eq_typed(&file.tree(), offset)),
'<' => on_left_angle_typed(&file.tree(), offset),
'>' => conv(on_right_angle_typed(&file.tree(), offset)),
'{' => conv(on_opening_brace_typed(file, offset)),
- _ => return None,
- };
-
- fn conv(text_edit: Option<TextEdit>) -> Option<ExtendedTextEdit> {
- Some(ExtendedTextEdit { edit: text_edit?, is_snippet: false })
+ _ => None,
}
}