From 3341d7e69204233075d7be89bea320297947a780 Mon Sep 17 00:00:00 2001 From: lumi Date: Mon, 22 May 2017 18:49:24 +0200 Subject: [PATCH] turns out i was wrong and clippy was right, all hail clippy --- src/element.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/element.rs b/src/element.rs index 31e0a16f..c77ed096 100644 --- a/src/element.rs +++ b/src/element.rs @@ -600,9 +600,8 @@ pub struct Children<'a> { impl<'a> Iterator for Children<'a> { type Item = &'a Element; - #[cfg_attr(feature = "cargo-clippy", allow(while_let_on_iterator))] fn next(&mut self) -> Option<&'a Element> { - while let Some(item) = self.iter.next() { + for item in &mut self.iter { if let Node::Element(ref child) = *item { return Some(child); } @@ -619,9 +618,8 @@ pub struct ChildrenMut<'a> { impl<'a> Iterator for ChildrenMut<'a> { type Item = &'a mut Element; - #[cfg_attr(feature = "cargo-clippy", allow(while_let_on_iterator))] fn next(&mut self) -> Option<&'a mut Element> { - while let Some(item) = self.iter.next() { + for item in &mut self.iter { if let Node::Element(ref mut child) = *item { return Some(child); } @@ -638,9 +636,8 @@ pub struct Texts<'a> { impl<'a> Iterator for Texts<'a> { type Item = &'a str; - #[cfg_attr(feature = "cargo-clippy", allow(while_let_on_iterator))] fn next(&mut self) -> Option<&'a str> { - while let Some(item) = self.iter.next() { + for item in &mut self.iter { if let Node::Text(ref child) = *item { return Some(child); } @@ -657,9 +654,8 @@ pub struct TextsMut<'a> { impl<'a> Iterator for TextsMut<'a> { type Item = &'a mut String; - #[cfg_attr(feature = "cargo-clippy", allow(while_let_on_iterator))] fn next(&mut self) -> Option<&'a mut String> { - while let Some(item) = self.iter.next() { + for item in &mut self.iter { if let Node::Text(ref mut child) = *item { return Some(child); }