aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_def/src/body/scope.rs2
-rw-r--r--crates/ra_text_edit/src/lib.rs4
-rw-r--r--crates/ra_text_edit/src/text_edit.rs6
3 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs
index a63552327..5d0279945 100644
--- a/crates/ra_hir_def/src/body/scope.rs
+++ b/crates/ra_hir_def/src/body/scope.rs
@@ -194,7 +194,7 @@ mod tests {
194 let (off, code) = extract_offset(code); 194 let (off, code) = extract_offset(code);
195 let code = { 195 let code = {
196 let mut buf = String::new(); 196 let mut buf = String::new();
197 let off = u32::from(off) as usize; 197 let off = off.to_usize();
198 buf.push_str(&code[..off]); 198 buf.push_str(&code[..off]);
199 buf.push_str("marker"); 199 buf.push_str("marker");
200 buf.push_str(&code[off..]); 200 buf.push_str(&code[off..]);
diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs
index 5f1b12222..37f23d043 100644
--- a/crates/ra_text_edit/src/lib.rs
+++ b/crates/ra_text_edit/src/lib.rs
@@ -29,8 +29,8 @@ impl AtomTextEdit {
29 } 29 }
30 30
31 pub fn apply(&self, mut text: String) -> String { 31 pub fn apply(&self, mut text: String) -> String {
32 let start = u32::from(self.delete.start()) as usize; 32 let start = self.delete.start().to_usize();
33 let end = u32::from(self.delete.end()) as usize; 33 let end = self.delete.end().to_usize();
34 text.replace_range(start..end, &self.insert); 34 text.replace_range(start..end, &self.insert);
35 text 35 text
36 } 36 }
diff --git a/crates/ra_text_edit/src/text_edit.rs b/crates/ra_text_edit/src/text_edit.rs
index 413c7d782..3291ada42 100644
--- a/crates/ra_text_edit/src/text_edit.rs
+++ b/crates/ra_text_edit/src/text_edit.rs
@@ -66,13 +66,13 @@ impl TextEdit {
66 let mut total_len = text.len(); 66 let mut total_len = text.len();
67 for atom in self.atoms.iter() { 67 for atom in self.atoms.iter() {
68 total_len += atom.insert.len(); 68 total_len += atom.insert.len();
69 total_len -= u32::from(atom.delete.end() - atom.delete.start()) as usize; 69 total_len -= (atom.delete.end() - atom.delete.start()).to_usize();
70 } 70 }
71 let mut buf = String::with_capacity(total_len); 71 let mut buf = String::with_capacity(total_len);
72 let mut prev = 0; 72 let mut prev = 0;
73 for atom in self.atoms.iter() { 73 for atom in self.atoms.iter() {
74 let start = u32::from(atom.delete.start()) as usize; 74 let start = atom.delete.start().to_usize();
75 let end = u32::from(atom.delete.end()) as usize; 75 let end = atom.delete.end().to_usize();
76 if start > prev { 76 if start > prev {
77 buf.push_str(&text[prev..start]); 77 buf.push_str(&text[prev..start]);
78 } 78 }