diff options
author | Alan Du <[email protected]> | 2019-06-04 07:58:22 +0100 |
---|---|---|
committer | Alan Du <[email protected]> | 2019-06-04 23:05:07 +0100 |
commit | 964edd99433e965aa24f2237d1530ce1c575fa8e (patch) | |
tree | 2309b1708507702fdc0d606f95320d3a9a2db4a0 /crates/ra_assists/src | |
parent | b28ca32db22d5e2ed34db556c6fd50a5fc2d679c (diff) |
Fix clippy::while_let_loop
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/ast_editor.rs | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/crates/ra_assists/src/ast_editor.rs b/crates/ra_assists/src/ast_editor.rs index cabb3d862..de0529b32 100644 --- a/crates/ra_assists/src/ast_editor.rs +++ b/crates/ra_assists/src/ast_editor.rs | |||
@@ -212,21 +212,17 @@ impl AstEditor<ast::FnDef> { | |||
212 | } | 212 | } |
213 | 213 | ||
214 | pub fn strip_attrs_and_docs(&mut self) { | 214 | pub fn strip_attrs_and_docs(&mut self) { |
215 | loop { | 215 | while let Some(start) = self |
216 | if let Some(start) = self | 216 | .ast() |
217 | .ast() | 217 | .syntax() |
218 | .syntax() | 218 | .children_with_tokens() |
219 | .children_with_tokens() | 219 | .find(|it| it.kind() == ATTR || it.kind() == COMMENT) |
220 | .find(|it| it.kind() == ATTR || it.kind() == COMMENT) | 220 | { |
221 | { | 221 | let end = match start.next_sibling_or_token() { |
222 | let end = match start.next_sibling_or_token() { | 222 | Some(el) if el.kind() == WHITESPACE => el, |
223 | Some(el) if el.kind() == WHITESPACE => el, | 223 | Some(_) | None => start, |
224 | Some(_) | None => start, | 224 | }; |
225 | }; | 225 | self.ast = self.replace_children(RangeInclusive::new(start, end), iter::empty()); |
226 | self.ast = self.replace_children(RangeInclusive::new(start, end), iter::empty()); | ||
227 | } else { | ||
228 | break; | ||
229 | } | ||
230 | } | 226 | } |
231 | } | 227 | } |
232 | } | 228 | } |