diff options
Diffstat (limited to 'crates/ra_ide/src/typing/on_enter.rs')
-rw-r--r-- | crates/ra_ide/src/typing/on_enter.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_ide/src/typing/on_enter.rs b/crates/ra_ide/src/typing/on_enter.rs index a40d8af9c..787e85ffd 100644 --- a/crates/ra_ide/src/typing/on_enter.rs +++ b/crates/ra_ide/src/typing/on_enter.rs | |||
@@ -75,18 +75,15 @@ fn node_indent(file: &SourceFile, token: &SyntaxToken) -> Option<SmolStr> { | |||
75 | 75 | ||
76 | #[cfg(test)] | 76 | #[cfg(test)] |
77 | mod tests { | 77 | mod tests { |
78 | use test_utils::{assert_eq_text, extract_offset}; | 78 | use test_utils::assert_eq_text; |
79 | 79 | ||
80 | use crate::mock_analysis::single_file; | 80 | use crate::mock_analysis::single_file_with_position; |
81 | |||
82 | use super::*; | ||
83 | 81 | ||
84 | fn apply_on_enter(before: &str) -> Option<String> { | 82 | fn apply_on_enter(before: &str) -> Option<String> { |
85 | let (offset, before) = extract_offset(before); | 83 | let (analysis, position) = single_file_with_position(&before); |
86 | let (analysis, file_id) = single_file(&before); | 84 | let result = analysis.on_enter(position).unwrap()?; |
87 | let result = analysis.on_enter(FilePosition { offset, file_id }).unwrap()?; | ||
88 | 85 | ||
89 | let mut actual = before.to_string(); | 86 | let mut actual = analysis.file_text(position.file_id).unwrap().to_string(); |
90 | result.apply(&mut actual); | 87 | result.apply(&mut actual); |
91 | Some(actual) | 88 | Some(actual) |
92 | } | 89 | } |