From 964edd99433e965aa24f2237d1530ce1c575fa8e Mon Sep 17 00:00:00 2001 From: Alan Du Date: Tue, 4 Jun 2019 02:58:22 -0400 Subject: Fix clippy::while_let_loop --- crates/ra_assists/src/ast_editor.rs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'crates/ra_assists') 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 { } pub fn strip_attrs_and_docs(&mut self) { - loop { - if let Some(start) = self - .ast() - .syntax() - .children_with_tokens() - .find(|it| it.kind() == ATTR || it.kind() == COMMENT) - { - let end = match start.next_sibling_or_token() { - Some(el) if el.kind() == WHITESPACE => el, - Some(_) | None => start, - }; - self.ast = self.replace_children(RangeInclusive::new(start, end), iter::empty()); - } else { - break; - } + while let Some(start) = self + .ast() + .syntax() + .children_with_tokens() + .find(|it| it.kind() == ATTR || it.kind() == COMMENT) + { + let end = match start.next_sibling_or_token() { + Some(el) if el.kind() == WHITESPACE => el, + Some(_) | None => start, + }; + self.ast = self.replace_children(RangeInclusive::new(start, end), iter::empty()); } } } -- cgit v1.2.3