Skip to content

Commit

Permalink
Fix clippy::manual_find lint (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Nov 13, 2024
1 parent c0e8ad8 commit 266442a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions examples/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ struct XmlNode<'a, 'input: 'a>(roxmltree::Node<'a, 'input>);
impl<'a, 'input: 'a> XmlNode<'a, 'input> {
fn select(&self, text: &str) -> Option<roxmltree::Node<'a, 'input>> {
let selectors = simplecss::Selector::parse(text)?;
for node in self.0.descendants().filter(|n| n.is_element()) {
if selectors.matches(&XmlNode(node)) {
return Some(node);
}
}

None
self.0
.descendants()
.filter(|n| n.is_element())
.find(|&node| selectors.matches(&XmlNode(node)))
}
}

Expand Down

0 comments on commit 266442a

Please sign in to comment.