diff --git a/scraper/src/element_ref/element.rs b/scraper/src/element_ref/element.rs index e804d81e..23d2a16e 100644 --- a/scraper/src/element_ref/element.rs +++ b/scraper/src/element_ref/element.rs @@ -9,7 +9,7 @@ use super::ElementRef; use crate::selector::{CssLocalName, CssString, NonTSPseudoClass, PseudoElement, Simple}; /// Note: will never match against non-tree-structure pseudo-classes. -impl<'a> Element for ElementRef<'a> { +impl Element for ElementRef<'_> { type Impl = Simple; fn opaque(&self) -> OpaqueElement { @@ -135,7 +135,7 @@ impl<'a> Element for ElementRef<'a> { fn is_root(&self) -> bool { self.parent() - .map_or(false, |parent| parent.value().is_document()) + .is_some_and(|parent| parent.value().is_document()) } fn apply_selector_flags(&self, _flags: matching::ElementSelectorFlags) {} diff --git a/scraper/src/element_ref/mod.rs b/scraper/src/element_ref/mod.rs index 4e8500e2..cfe2a3d9 100644 --- a/scraper/src/element_ref/mod.rs +++ b/scraper/src/element_ref/mod.rs @@ -117,7 +117,7 @@ impl<'a> ElementRef<'a> { } } -impl<'a> Debug for ElementRef<'a> { +impl Debug for ElementRef<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { Debug::fmt(self.value(), f) } @@ -160,7 +160,7 @@ impl Clone for Select<'_, '_> { } } -impl<'a, 'b> Iterator for Select<'a, 'b> { +impl<'a> Iterator for Select<'a, '_> { type Item = ElementRef<'a>; fn next(&mut self) -> Option> { diff --git a/scraper/src/element_ref/serializable.rs b/scraper/src/element_ref/serializable.rs index 98dda704..0b88c8d3 100644 --- a/scraper/src/element_ref/serializable.rs +++ b/scraper/src/element_ref/serializable.rs @@ -4,7 +4,7 @@ use html5ever::serialize::{Serialize, Serializer, TraversalScope}; use crate::ElementRef; -impl<'a> Serialize for ElementRef<'a> { +impl Serialize for ElementRef<'_> { fn serialize( &self, serializer: &mut S, diff --git a/scraper/src/error.rs b/scraper/src/error.rs index 15141eed..ef27dea1 100644 --- a/scraper/src/error.rs +++ b/scraper/src/error.rs @@ -73,7 +73,7 @@ impl<'a> From> for SelectorErrorKind<'a> { } } -impl<'a> Display for SelectorErrorKind<'a> { +impl Display for SelectorErrorKind<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, @@ -103,7 +103,7 @@ impl<'a> Display for SelectorErrorKind<'a> { } } -impl<'a> Error for SelectorErrorKind<'a> { +impl Error for SelectorErrorKind<'_> { fn description(&self) -> &str { match self { Self::UnexpectedToken(_) => "Token was not expected", diff --git a/scraper/src/html/mod.rs b/scraper/src/html/mod.rs index 39ad74cf..f64578bb 100644 --- a/scraper/src/html/mod.rs +++ b/scraper/src/html/mod.rs @@ -153,7 +153,7 @@ impl Clone for Select<'_, '_> { } } -impl<'a, 'b> Iterator for Select<'a, 'b> { +impl<'a> Iterator for Select<'a, '_> { type Item = ElementRef<'a>; fn next(&mut self) -> Option> { @@ -178,7 +178,7 @@ impl<'a, 'b> Iterator for Select<'a, 'b> { } } -impl<'a, 'b> DoubleEndedIterator for Select<'a, 'b> { +impl DoubleEndedIterator for Select<'_, '_> { fn next_back(&mut self) -> Option { for node in self.inner.by_ref().rev() { if let Some(element) = ElementRef::wrap(node) { diff --git a/scraper/src/html/tree_sink.rs b/scraper/src/html/tree_sink.rs index f9e18720..02d43eb6 100644 --- a/scraper/src/html/tree_sink.rs +++ b/scraper/src/html/tree_sink.rs @@ -141,7 +141,7 @@ impl TreeSink for HtmlTreeSink { NodeOrText::AppendText(text) => { let text = make_tendril(text); - let did_concat = parent.last_child().map_or(false, |mut n| match n.value() { + let did_concat = parent.last_child().is_some_and(|mut n| match n.value() { Node::Text(t) => { t.text.push_tendril(&text); true @@ -181,16 +181,13 @@ impl TreeSink for HtmlTreeSink { NodeOrText::AppendText(text) => { let text = make_tendril(text); - let did_concat = - sibling - .prev_sibling() - .map_or(false, |mut n| match n.value() { - Node::Text(t) => { - t.text.push_tendril(&text); - true - } - _ => false, - }); + let did_concat = sibling.prev_sibling().is_some_and(|mut n| match n.value() { + Node::Text(t) => { + t.text.push_tendril(&text); + true + } + _ => false, + }); if !did_concat { sibling.insert_before(Node::Text(Text { text })); diff --git a/scraper/src/main.rs b/scraper/src/main.rs index 9d4684b3..8f9de9fa 100644 --- a/scraper/src/main.rs +++ b/scraper/src/main.rs @@ -125,8 +125,7 @@ fn main() { .iter() .map(File::open) .map(Result::unwrap) - .map(|mut f| query(&input, &output, &selector, &mut f)) - .any(|m| m) + .any(|mut f| query(&input, &output, &selector, &mut f)) }; process::exit(i32::from(!matched));