From 76e170c3d0d0784c0e612c5849798c65a2034f29 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 14:12:53 +0200 Subject: Less rust-analyzer specific onEnter --- crates/ra_ide/src/typing/on_enter.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'crates/ra_ide/src/typing') diff --git a/crates/ra_ide/src/typing/on_enter.rs b/crates/ra_ide/src/typing/on_enter.rs index e7d64b4f6..a40d8af9c 100644 --- a/crates/ra_ide/src/typing/on_enter.rs +++ b/crates/ra_ide/src/typing/on_enter.rs @@ -11,9 +11,7 @@ use ra_syntax::{ }; use ra_text_edit::TextEdit; -use crate::{SourceChange, SourceFileEdit}; - -pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option { +pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option { let parse = db.parse(position.file_id); let file = parse.tree(); let comment = file @@ -41,9 +39,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option bool { @@ -90,9 +86,8 @@ mod tests { let (analysis, file_id) = single_file(&before); let result = analysis.on_enter(FilePosition { offset, file_id }).unwrap()?; - assert_eq!(result.source_file_edits.len(), 1); let mut actual = before.to_string(); - result.source_file_edits[0].edit.apply(&mut actual); + result.apply(&mut actual); Some(actual) } -- cgit v1.2.3