Skip to content

Commit 9242d09

Browse files
authored
Merge pull request #190 from gfaster/master
Make ElementRef Debug impl use Element
2 parents 27dd786 + f5cc684 commit 9242d09

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/element_ref/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Element references.
22
3-
use std::fmt;
3+
use std::fmt::{self, Debug};
44
use std::ops::Deref;
55

66
use ego_tree::iter::{Edge, Traverse};
@@ -15,7 +15,7 @@ use crate::{Node, Selector};
1515
///
1616
/// This wrapper implements the `Element` trait from the `selectors` crate, which allows it to be
1717
/// matched against CSS selectors.
18-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
18+
#[derive(Clone, Copy, PartialEq, Eq)]
1919
pub struct ElementRef<'a> {
2020
node: NodeRef<'a, Node>,
2121
}
@@ -116,6 +116,12 @@ impl<'a> ElementRef<'a> {
116116
}
117117
}
118118

119+
impl<'a> Debug for ElementRef<'a> {
120+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
121+
Debug::fmt(self.value(), f)
122+
}
123+
}
124+
119125
impl<'a> Deref for ElementRef<'a> {
120126
type Target = NodeRef<'a, Node>;
121127
fn deref(&self) -> &NodeRef<'a, Node> {
@@ -131,7 +137,7 @@ pub struct Select<'a, 'b> {
131137
nth_index_cache: NthIndexCache,
132138
}
133139

134-
impl fmt::Debug for Select<'_, '_> {
140+
impl Debug for Select<'_, '_> {
135141
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
136142
fmt.debug_struct("Select")
137143
.field("scope", &self.scope)

0 commit comments

Comments
 (0)