style: Account for a few more cases in the node's debug-formatting code.

This commit is contained in:
Emilio Cobos Álvarez 2018-03-03 22:33:50 +01:00
parent a19219ec79
commit 56fc1a6649
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -170,14 +170,22 @@ impl<'ln> PartialEq for GeckoNode<'ln> {
impl<'ln> fmt::Debug for GeckoNode<'ln> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if let Some(el) = self.as_element() {
el.fmt(f)
} else {
if self.is_text_node() {
write!(f, "<text node> ({:#x})", self.opaque().0)
} else {
write!(f, "<non-text node> ({:#x})", self.opaque().0)
}
return el.fmt(f)
}
if self.is_text_node() {
return write!(f, "<text node> ({:#x})", self.opaque().0)
}
if self.is_document() {
return write!(f, "<document> ({:#x})", self.opaque().0)
}
if self.is_shadow_root() {
return write!(f, "<shadow-root> ({:#x})", self.opaque().0)
}
write!(f, "<non-text node> ({:#x})", self.opaque().0)
}
}