Remove debug prints

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2023-04-17 23:40:09 +02:00
parent 2f082be1f6
commit f5ac2d7ec6
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -77,7 +77,6 @@ impl ScanNode {
impl PartialEq<Node> for ScanNode {
fn eq(&self, other: &Node) -> bool {
println!("PartialEq<Node> for ScanNode:\n{:?}\n{:?}", self, other);
match (&self.node, other) {
(Node::Text(text1), Node::Text(text2)) => {
text1 == text2
@ -124,13 +123,10 @@ fn filter_whitespace_nodes(nodes: Vec<Node>) -> Vec<Node> {
.into_iter()
.fold((None::<NodeType>, vec![]), filter_nodes).1;
println!("filter_whitespace_nodes: {:?}", nodes);
// Don't remove possibly significant whitespace text leaves
if nodes.iter().count() == 1 {
println!("Count: 1");
nodes
} else {
println!("Count: plus");
nodes
.into_iter()
.filter(rm_empty_text)
@ -221,11 +217,6 @@ impl<'a> PartialEq<&Element> for ScanElement<'a> {
if self.elem.name() == other.name() &&
self_ns == other.ns() {
println!("FOO0: {{{}}}{}", self.elem.ns(), self.elem.name());
for attr in self.elem.attrs() {
println!("FOO1: attr: {:?}", attr);
}
let strict_attr = self.elem.attr("scansion:strict");
// Force true if scansion:strict is set or if a tag isn't in the default ns.
@ -234,20 +225,17 @@ impl<'a> PartialEq<&Element> for ScanElement<'a> {
} else {
self_ns != DEFAULT_NS
};
println!("FOO: Strict: {:?}", strict);
for (attr, val) in self.elem.attrs() {
println!("FOO: Attr: {} / {}", attr, val);
match (attr, other.attr(attr)) {
(attr, _) if attr == "scansion:strict" => continue,
(_, None) => return false,
(_, Some(oval)) if val != oval => return false,
foo => println!("FOO: {:?}", foo),
_ => (),
}
}
let onodes = other.nodes().cloned().collect::<Vec<_>>();
println!("FOO-2: foo2 {:?}", onodes);
// Compare attributes count
if strict {
@ -261,11 +249,9 @@ impl<'a> PartialEq<&Element> for ScanElement<'a> {
}
let nodes = ScanNodes::new_strict(self.elem.nodes().cloned().collect());
println!("FOO-1: foo1 {:?}", nodes);
nodes == onodes
} else {
let nodes = ScanNodes::<NonStrictComparison>::new(self.elem.nodes().cloned().collect());
println!("FOO-1: foo1 {:?}", nodes);
let nodes = ScanNodes::new(self.elem.nodes().cloned().collect());
nodes == onodes
}
} else {
@ -361,11 +347,9 @@ mod tests {
let elem2: Element = "<presence scansion:strict='true' xmlns='jabber:client'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>".parse().unwrap();
println!("BAR0: {:?}", elem2);
let elem3: Element = "<presence xmlns='jabber:client'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>".parse().unwrap();
println!("BAR1: {:?}", elem3);
let scan2 = ScanElement::new(&elem2);
assert_eq!(scan2, &elem3);
@ -408,12 +392,10 @@ mod tests {
<photo/>
</x>
</presence>".parse().unwrap();
println!("BAR0: {:?}", elem1);
let elem2: Element = "<presence scansion:strict='true' xmlns='jabber:client'>
<x xmlns='http://jabber.org/protocol/muc' />
<x xmlns='vcard-temp:x:update'/>
</presence>".parse().unwrap();
println!("BAR1: {:?}", elem2);
let scan1 = ScanElement::new(&elem1);
assert_ne!(scan1, &elem2);