Fix clippy::while_let_loop

This commit is contained in:
Alan Du 2019-06-04 02:58:22 -04:00
parent b28ca32db2
commit 964edd9943

View file

@ -212,21 +212,17 @@ impl AstEditor<ast::FnDef> {
} }
pub fn strip_attrs_and_docs(&mut self) { pub fn strip_attrs_and_docs(&mut self) {
loop { while let Some(start) = self
if let Some(start) = self .ast()
.ast() .syntax()
.syntax() .children_with_tokens()
.children_with_tokens() .find(|it| it.kind() == ATTR || it.kind() == COMMENT)
.find(|it| it.kind() == ATTR || it.kind() == COMMENT) {
{ let end = match start.next_sibling_or_token() {
let end = match start.next_sibling_or_token() { Some(el) if el.kind() == WHITESPACE => el,
Some(el) if el.kind() == WHITESPACE => el, Some(_) | None => start,
Some(_) | None => start, };
}; self.ast = self.replace_children(RangeInclusive::new(start, end), iter::empty());
self.ast = self.replace_children(RangeInclusive::new(start, end), iter::empty());
} else {
break;
}
} }
} }
} }