11//! Element references.
22
3- use std:: fmt;
3+ use std:: fmt:: { self , Debug } ;
44use std:: ops:: Deref ;
55
66use 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 ) ]
1919pub 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+
119125impl < ' 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