Skip to content

Commit 874f28b

Browse files
committed
Follow clippy suggestions
1 parent 27005a3 commit 874f28b

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

src/element_ref/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl<'a> ElementRef<'a> {
4343
inner.next(); // Skip Edge::Open(self).
4444

4545
Select {
46-
scope: self.clone(),
46+
scope: *self,
4747
inner,
4848
selector,
4949
}

src/node.rs

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,50 +38,32 @@ pub enum Node {
3838
impl Node {
3939
/// Returns true if node is the document root.
4040
pub fn is_document(&self) -> bool {
41-
match *self {
42-
Node::Document => true,
43-
_ => false,
44-
}
41+
matches!(*self, Node::Document)
4542
}
4643

4744
/// Returns true if node is the fragment root.
4845
pub fn is_fragment(&self) -> bool {
49-
match *self {
50-
Node::Fragment => true,
51-
_ => false,
52-
}
46+
matches!(*self, Node::Fragment)
5347
}
5448

5549
/// Returns true if node is a doctype.
5650
pub fn is_doctype(&self) -> bool {
57-
match *self {
58-
Node::Doctype(_) => true,
59-
_ => false,
60-
}
51+
matches!(*self, Node::Doctype(_))
6152
}
6253

6354
/// Returns true if node is a comment.
6455
pub fn is_comment(&self) -> bool {
65-
match *self {
66-
Node::Comment(_) => true,
67-
_ => false,
68-
}
56+
matches!(*self, Node::Comment(_))
6957
}
7058

7159
/// Returns true if node is text.
7260
pub fn is_text(&self) -> bool {
73-
match *self {
74-
Node::Text(_) => true,
75-
_ => false,
76-
}
61+
matches!(*self, Node::Text(_))
7762
}
7863

7964
/// Returns true if node is an element.
8065
pub fn is_element(&self) -> bool {
81-
match *self {
82-
Node::Element(_) => true,
83-
_ => false,
84-
}
66+
matches!(*self, Node::Element(_))
8567
}
8668

8769
/// Returns self as a doctype.
@@ -285,7 +267,7 @@ impl Element {
285267

286268
/// Returns the element ID.
287269
pub fn id(&self) -> Option<&str> {
288-
self.id.as_ref().map(Deref::deref)
270+
self.id.as_deref()
289271
}
290272

291273
/// Returns true if element has the class.

src/selector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Selector {
4949
context.scope_element = scope.map(|x| selectors::Element::opaque(&x));
5050
self.selectors
5151
.iter()
52-
.any(|s| matching::matches_selector(&s, 0, None, element, &mut context, &mut |_, _| {}))
52+
.any(|s| matching::matches_selector(s, 0, None, element, &mut context, &mut |_, _| {}))
5353
}
5454
}
5555

0 commit comments

Comments
 (0)