diff options
author | Veetaha <[email protected]> | 2020-02-09 23:57:43 +0000 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-02-09 23:57:43 +0000 |
commit | 139479e8a376aecff35db2055b9ebd2311935f98 (patch) | |
tree | 1b3f1e21b0fd2f920940d22c7c8076fcf855cedc /crates/ra_text_edit | |
parent | c48c0f370a6d02c7065864c8eb761cf9e4ba2363 (diff) |
move to to_usize()
Diffstat (limited to 'crates/ra_text_edit')
-rw-r--r-- | crates/ra_text_edit/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/ra_text_edit/src/text_edit.rs | 6 |
2 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 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 | } |