diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2022-05-07 04:02:26 +0000 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2023-10-02 14:37:19 +0000 |
commit | 898cafb5a5a45cf88e7863782a251c767a9fc59c (patch) | |
tree | 2156d14fc3857fd89d4ba4c22acaa65380e1b670 /components | |
parent | 2302d828a58ac27df0b37fbbed146b2e525e5431 (diff) | |
download | servo-898cafb5a5a45cf88e7863782a251c767a9fc59c.tar.gz servo-898cafb5a5a45cf88e7863782a251c767a9fc59c.zip |
style: Use debug_unreachable!() in matches_simple_selector
This shrinks the function by avoiding generating rather noisy panic
code.
Depends on D145486
Differential Revision: https://phabricator.services.mozilla.com/D145487
Diffstat (limited to 'components')
-rw-r--r-- | components/selectors/Cargo.toml | 1 | ||||
-rw-r--r-- | components/selectors/matching.rs | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/components/selectors/Cargo.toml b/components/selectors/Cargo.toml index bb9efec3a05..884f8c009ac 100644 --- a/components/selectors/Cargo.toml +++ b/components/selectors/Cargo.toml @@ -25,6 +25,7 @@ cssparser = "0.29" derive_more = "0.99" fxhash = "0.2" log = "0.4" +new_debug_unreachable = "1" phf = "0.10" precomputed-hash = "0.1" servo_arc = { version = "0.2", path = "../servo_arc" } diff --git a/components/selectors/matching.rs b/components/selectors/matching.rs index 1628e53b890..c41ff0d362f 100644 --- a/components/selectors/matching.rs +++ b/components/selectors/matching.rs @@ -9,6 +9,7 @@ use crate::parser::{AncestorHashes, Combinator, Component, LocalName}; use crate::parser::{NonTSPseudoClass, Selector, SelectorImpl, SelectorIter, SelectorList}; use crate::tree::Element; use bitflags::bitflags; +use debug_unreachable::debug_unreachable; use log::debug; use smallvec::SmallVec; use std::borrow::Borrow; @@ -832,7 +833,9 @@ where } true }), - Component::Combinator(_) => unreachable!(), + Component::Combinator(_) => unsafe { + debug_unreachable!("Shouldn't try to selector-match combinators") + }, } } |