diff options
Diffstat (limited to 'crates/ra_ide/src/typing.rs')
-rw-r--r-- | crates/ra_ide/src/typing.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index 2a8b4327f..a03da4693 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs | |||
@@ -142,10 +142,13 @@ mod tests { | |||
142 | fn do_type_char(char_typed: char, before: &str) -> Option<(String, SingleFileChange)> { | 142 | fn do_type_char(char_typed: char, before: &str) -> Option<(String, SingleFileChange)> { |
143 | let (offset, before) = extract_offset(before); | 143 | let (offset, before) = extract_offset(before); |
144 | let edit = TextEdit::insert(offset, char_typed.to_string()); | 144 | let edit = TextEdit::insert(offset, char_typed.to_string()); |
145 | let before = edit.apply(&before); | 145 | let mut before = before.to_string(); |
146 | edit.apply(&mut before); | ||
146 | let parse = SourceFile::parse(&before); | 147 | let parse = SourceFile::parse(&before); |
147 | on_char_typed_inner(&parse.tree(), offset, char_typed) | 148 | on_char_typed_inner(&parse.tree(), offset, char_typed).map(|it| { |
148 | .map(|it| (it.edit.apply(&before), it)) | 149 | it.edit.apply(&mut before); |
150 | (before.to_string(), it) | ||
151 | }) | ||
149 | } | 152 | } |
150 | 153 | ||
151 | fn type_char(char_typed: char, before: &str, after: &str) { | 154 | fn type_char(char_typed: char, before: &str, after: &str) { |