diff options
author | Aleksey Kladov <[email protected]> | 2020-05-21 14:56:18 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-21 14:56:18 +0100 |
commit | 5f57491c981530103e1e26dcd280e1a2df10f853 (patch) | |
tree | 4f68def42ca0230c6e6d0e3ed98cd351c9e2d79b /crates/ra_ide/src | |
parent | 3cba0dc26b707bebc1865671fd2c5139c1e1c537 (diff) |
Cleanup TextEdit
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/completion/completion_item.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/references/rename.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/test_utils.rs | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_ide/src/completion/completion_item.rs b/crates/ra_ide/src/completion/completion_item.rs index 6021f7279..cfb7c1e38 100644 --- a/crates/ra_ide/src/completion/completion_item.rs +++ b/crates/ra_ide/src/completion/completion_item.rs | |||
@@ -63,8 +63,8 @@ impl fmt::Debug for CompletionItem { | |||
63 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | 63 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
64 | let mut s = f.debug_struct("CompletionItem"); | 64 | let mut s = f.debug_struct("CompletionItem"); |
65 | s.field("label", &self.label()).field("source_range", &self.source_range()); | 65 | s.field("label", &self.label()).field("source_range", &self.source_range()); |
66 | if self.text_edit().as_indels().len() == 1 { | 66 | if self.text_edit().len() == 1 { |
67 | let atom = &self.text_edit().as_indels()[0]; | 67 | let atom = &self.text_edit().iter().next().unwrap(); |
68 | s.field("delete", &atom.delete); | 68 | s.field("delete", &atom.delete); |
69 | s.field("insert", &atom.insert); | 69 | s.field("insert", &atom.insert); |
70 | } else { | 70 | } else { |
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 55c3319cb..fd2163dad 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs | |||
@@ -983,8 +983,8 @@ mod tests { | |||
983 | if let Some(change) = source_change { | 983 | if let Some(change) = source_change { |
984 | for edit in change.info.source_file_edits { | 984 | for edit in change.info.source_file_edits { |
985 | file_id = Some(edit.file_id); | 985 | file_id = Some(edit.file_id); |
986 | for indel in edit.edit.as_indels() { | 986 | for indel in edit.edit.into_iter() { |
987 | text_edit_builder.replace(indel.delete, indel.insert.clone()); | 987 | text_edit_builder.replace(indel.delete, indel.insert); |
988 | } | 988 | } |
989 | } | 989 | } |
990 | } | 990 | } |
diff --git a/crates/ra_ide/src/test_utils.rs b/crates/ra_ide/src/test_utils.rs index 48c8fd1f4..b335582a3 100644 --- a/crates/ra_ide/src/test_utils.rs +++ b/crates/ra_ide/src/test_utils.rs | |||
@@ -3,9 +3,9 @@ | |||
3 | use ra_syntax::{SourceFile, TextSize}; | 3 | use ra_syntax::{SourceFile, TextSize}; |
4 | use ra_text_edit::TextEdit; | 4 | use ra_text_edit::TextEdit; |
5 | 5 | ||
6 | pub use test_utils::*; | 6 | pub(crate) use test_utils::*; |
7 | 7 | ||
8 | pub fn check_action<F: Fn(&SourceFile, TextSize) -> Option<TextEdit>>( | 8 | pub(crate) fn check_action<F: Fn(&SourceFile, TextSize) -> Option<TextEdit>>( |
9 | before: &str, | 9 | before: &str, |
10 | after: &str, | 10 | after: &str, |
11 | f: F, | 11 | f: F, |