Skip to content

Commit 8d3e74b

Browse files
authored
Merge pull request #220 from rust-scraper/make-clippy-happy
Make current nightly version of Clippy happy.
2 parents 93afdd9 + 47cc9de commit 8d3e74b

File tree

7 files changed

+18
-22
lines changed

7 files changed

+18
-22
lines changed

scraper/src/element_ref/element.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use super::ElementRef;
99
use crate::selector::{CssLocalName, CssString, NonTSPseudoClass, PseudoElement, Simple};
1010

1111
/// Note: will never match against non-tree-structure pseudo-classes.
12-
impl<'a> Element for ElementRef<'a> {
12+
impl Element for ElementRef<'_> {
1313
type Impl = Simple;
1414

1515
fn opaque(&self) -> OpaqueElement {
@@ -135,7 +135,7 @@ impl<'a> Element for ElementRef<'a> {
135135

136136
fn is_root(&self) -> bool {
137137
self.parent()
138-
.map_or(false, |parent| parent.value().is_document())
138+
.is_some_and(|parent| parent.value().is_document())
139139
}
140140

141141
fn apply_selector_flags(&self, _flags: matching::ElementSelectorFlags) {}

scraper/src/element_ref/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'a> ElementRef<'a> {
117117
}
118118
}
119119

120-
impl<'a> Debug for ElementRef<'a> {
120+
impl Debug for ElementRef<'_> {
121121
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
122122
Debug::fmt(self.value(), f)
123123
}
@@ -160,7 +160,7 @@ impl Clone for Select<'_, '_> {
160160
}
161161
}
162162

163-
impl<'a, 'b> Iterator for Select<'a, 'b> {
163+
impl<'a> Iterator for Select<'a, '_> {
164164
type Item = ElementRef<'a>;
165165

166166
fn next(&mut self) -> Option<ElementRef<'a>> {

scraper/src/element_ref/serializable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use html5ever::serialize::{Serialize, Serializer, TraversalScope};
44

55
use crate::ElementRef;
66

7-
impl<'a> Serialize for ElementRef<'a> {
7+
impl Serialize for ElementRef<'_> {
88
fn serialize<S: Serializer>(
99
&self,
1010
serializer: &mut S,

scraper/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'a> From<SelectorParseErrorKind<'a>> for SelectorErrorKind<'a> {
7373
}
7474
}
7575

76-
impl<'a> Display for SelectorErrorKind<'a> {
76+
impl Display for SelectorErrorKind<'_> {
7777
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7878
write!(
7979
f,
@@ -103,7 +103,7 @@ impl<'a> Display for SelectorErrorKind<'a> {
103103
}
104104
}
105105

106-
impl<'a> Error for SelectorErrorKind<'a> {
106+
impl Error for SelectorErrorKind<'_> {
107107
fn description(&self) -> &str {
108108
match self {
109109
Self::UnexpectedToken(_) => "Token was not expected",

scraper/src/html/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl Clone for Select<'_, '_> {
153153
}
154154
}
155155

156-
impl<'a, 'b> Iterator for Select<'a, 'b> {
156+
impl<'a> Iterator for Select<'a, '_> {
157157
type Item = ElementRef<'a>;
158158

159159
fn next(&mut self) -> Option<ElementRef<'a>> {
@@ -178,7 +178,7 @@ impl<'a, 'b> Iterator for Select<'a, 'b> {
178178
}
179179
}
180180

181-
impl<'a, 'b> DoubleEndedIterator for Select<'a, 'b> {
181+
impl DoubleEndedIterator for Select<'_, '_> {
182182
fn next_back(&mut self) -> Option<Self::Item> {
183183
for node in self.inner.by_ref().rev() {
184184
if let Some(element) = ElementRef::wrap(node) {

scraper/src/html/tree_sink.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl TreeSink for HtmlTreeSink {
141141
NodeOrText::AppendText(text) => {
142142
let text = make_tendril(text);
143143

144-
let did_concat = parent.last_child().map_or(false, |mut n| match n.value() {
144+
let did_concat = parent.last_child().is_some_and(|mut n| match n.value() {
145145
Node::Text(t) => {
146146
t.text.push_tendril(&text);
147147
true
@@ -181,16 +181,13 @@ impl TreeSink for HtmlTreeSink {
181181
NodeOrText::AppendText(text) => {
182182
let text = make_tendril(text);
183183

184-
let did_concat =
185-
sibling
186-
.prev_sibling()
187-
.map_or(false, |mut n| match n.value() {
188-
Node::Text(t) => {
189-
t.text.push_tendril(&text);
190-
true
191-
}
192-
_ => false,
193-
});
184+
let did_concat = sibling.prev_sibling().is_some_and(|mut n| match n.value() {
185+
Node::Text(t) => {
186+
t.text.push_tendril(&text);
187+
true
188+
}
189+
_ => false,
190+
});
194191

195192
if !did_concat {
196193
sibling.insert_before(Node::Text(Text { text }));

scraper/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ fn main() {
125125
.iter()
126126
.map(File::open)
127127
.map(Result::unwrap)
128-
.map(|mut f| query(&input, &output, &selector, &mut f))
129-
.any(|m| m)
128+
.any(|mut f| query(&input, &output, &selector, &mut f))
130129
};
131130

132131
process::exit(i32::from(!matched));

0 commit comments

Comments
 (0)