diff --git a/components/script/xpath/eval.rs b/components/script/xpath/eval.rs
index 42791006bc2..4fd70ec1c97 100644
--- a/components/script/xpath/eval.rs
+++ b/components/script/xpath/eval.rs
@@ -95,10 +95,7 @@ where
}
fn is_primitive(&self) -> bool {
- match self {
- Some(expr) => expr.is_primitive(),
- None => false,
- }
+ self.as_ref().is_some_and(|t| T::is_primitive(t))
}
}
diff --git a/tests/wpt/tests/domxpath/fn-id.html b/tests/wpt/tests/domxpath/fn-id.html
index 251de43024c..617ff7216d8 100644
--- a/tests/wpt/tests/domxpath/fn-id.html
+++ b/tests/wpt/tests/domxpath/fn-id.html
@@ -44,4 +44,4 @@ testIdFunction('id("")', 'Empty ID
', []);
// Test whitespace in ID string
testIdFunction('id(" test1 ")', 'Match
', ['test1']);
-