diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-26 18:11:58 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-26 18:11:58 +0100 |
commit | 733fd64260793a0f7335e4f75ba9197d5fa98b70 (patch) | |
tree | 644d492ac7bc4a08cd7938be0218dbf8f88b598b /crates/ra_ide_api/src/completion/completion_item.rs | |
parent | 568ef921acb8d35eed434089c1b1947c585c3f4c (diff) | |
parent | 431e4ff4ef83455adc7e2c0e3f732d6dc482641e (diff) |
Merge #2079
2079: avoid TextEditorBuilder for simple edits r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/completion/completion_item.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_item.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index 3e6933bc1..5c9c44704 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs | |||
@@ -4,7 +4,7 @@ use std::fmt; | |||
4 | 4 | ||
5 | use hir::Documentation; | 5 | use hir::Documentation; |
6 | use ra_syntax::TextRange; | 6 | use ra_syntax::TextRange; |
7 | use ra_text_edit::{TextEdit, TextEditBuilder}; | 7 | use ra_text_edit::TextEdit; |
8 | 8 | ||
9 | /// `CompletionItem` describes a single completion variant in the editor pop-up. | 9 | /// `CompletionItem` describes a single completion variant in the editor pop-up. |
10 | /// It is basically a POD with various properties. To construct a | 10 | /// It is basically a POD with various properties. To construct a |
@@ -192,12 +192,10 @@ impl Builder { | |||
192 | let label = self.label; | 192 | let label = self.label; |
193 | let text_edit = match self.text_edit { | 193 | let text_edit = match self.text_edit { |
194 | Some(it) => it, | 194 | Some(it) => it, |
195 | None => { | 195 | None => TextEdit::replace( |
196 | let mut builder = TextEditBuilder::default(); | 196 | self.source_range, |
197 | builder | 197 | self.insert_text.unwrap_or_else(|| label.clone()), |
198 | .replace(self.source_range, self.insert_text.unwrap_or_else(|| label.clone())); | 198 | ), |
199 | builder.finish() | ||
200 | } | ||
201 | }; | 199 | }; |
202 | 200 | ||
203 | CompletionItem { | 201 | CompletionItem { |