aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_text_edit/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_text_edit/src/lib.rs')
-rw-r--r--crates/ra_text_edit/src/lib.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs
index f6769e6a6..e656260c7 100644
--- a/crates/ra_text_edit/src/lib.rs
+++ b/crates/ra_text_edit/src/lib.rs
@@ -2,7 +2,7 @@
2 2
3mod text_edit; 3mod text_edit;
4 4
5use text_unit::{TextRange, TextUnit}; 5use text_size::{TextRange, TextSize};
6 6
7pub use crate::text_edit::{TextEdit, TextEditBuilder}; 7pub use crate::text_edit::{TextEdit, TextEditBuilder};
8 8
@@ -23,13 +23,13 @@ impl AtomTextEdit {
23 AtomTextEdit::replace(range, String::new()) 23 AtomTextEdit::replace(range, String::new())
24 } 24 }
25 25
26 pub fn insert(offset: TextUnit, text: String) -> AtomTextEdit { 26 pub fn insert(offset: TextSize, text: String) -> AtomTextEdit {
27 AtomTextEdit::replace(TextRange::offset_len(offset, 0.into()), text) 27 AtomTextEdit::replace(TextRange::empty(offset), text)
28 } 28 }
29 29
30 pub fn apply(&self, mut text: String) -> String { 30 pub fn apply(&self, mut text: String) -> String {
31 let start = self.delete.start().to_usize(); 31 let start: usize = self.delete.start().into();
32 let end = self.delete.end().to_usize(); 32 let end: usize = self.delete.end().into();
33 text.replace_range(start..end, &self.insert); 33 text.replace_range(start..end, &self.insert);
34 text 34 text
35 } 35 }