From f881b763c1d6bf49477191ba5fbf2d489fe2bbd6 Mon Sep 17 00:00:00 2001 From: mgros Date: Sat, 26 Sep 2026 18:42:34 +0200 Subject: [PATCH] Simplify `is_leaf_any_name` --- src/xpath_functions.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/xpath_functions.rs b/src/xpath_functions.rs index a713fad8..c0e193af 100644 --- a/src/xpath_functions.rs +++ b/src/xpath_functions.rs @@ -392,13 +392,7 @@ impl Function for IsNode { fn is_leaf_any_name(e: Element) -> bool { let children = e.children(); - if children.is_empty() { - return true; - } else if children.len() == 1 && - let ChildOfElement::Text(_) = children[0] { - return true; - } - return false + return children.is_empty() || (children.len() == 1 && children[0].text().is_some()); } } }