aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_text_edit/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-08-12 12:51:53 +0100
committerGitHub <[email protected]>2020-08-12 12:51:53 +0100
commit4b3d99f98f393d1c05b1041d3178cae45ebcd3ff (patch)
treeded304d310badd7d1dc040efa2c8c17572019464 /crates/ra_text_edit/src/lib.rs
parentf6c0b1ce59c9fa5bcbf482b1b9d16a3bae6abf1c (diff)
parentfcd4b0176f1544b389c9b028c547a1dfc92f9a56 (diff)
Merge #5699
5699: Fix clippy warnings r=matklad a=popzxc Currently clippy spawns a bunch of warnings on the `rust-analyzer` project. Nothing critical, but easy to fix, so I guess it won't harm. Co-authored-by: Igor Aleksanov <[email protected]>
Diffstat (limited to 'crates/ra_text_edit/src/lib.rs')
-rw-r--r--crates/ra_text_edit/src/lib.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs
index 25554f583..d68791cf1 100644
--- a/crates/ra_text_edit/src/lib.rs
+++ b/crates/ra_text_edit/src/lib.rs
@@ -76,10 +76,6 @@ impl TextEdit {
76 self.indels.iter() 76 self.indels.iter()
77 } 77 }
78 78
79 pub fn into_iter(self) -> vec::IntoIter<Indel> {
80 self.indels.into_iter()
81 }
82
83 pub fn apply(&self, text: &mut String) { 79 pub fn apply(&self, text: &mut String) {
84 match self.len() { 80 match self.len() {
85 0 => return, 81 0 => return,
@@ -141,6 +137,15 @@ impl TextEdit {
141 } 137 }
142} 138}
143 139
140impl IntoIterator for TextEdit {
141 type Item = Indel;
142 type IntoIter = vec::IntoIter<Self::Item>;
143
144 fn into_iter(self) -> Self::IntoIter {
145 self.indels.into_iter()
146 }
147}
148
144impl TextEditBuilder { 149impl TextEditBuilder {
145 pub fn replace(&mut self, range: TextRange, replace_with: String) { 150 pub fn replace(&mut self, range: TextRange, replace_with: String) {
146 self.indels.push(Indel::replace(range, replace_with)) 151 self.indels.push(Indel::replace(range, replace_with))