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
This commit is contained in:
Emilio Cobos Álvarez 2022-05-07 04:02:26 +00:00 committed by Martin Robinson
parent 2302d828a5
commit 898cafb5a5
3 changed files with 6 additions and 1 deletions

1
Cargo.lock generated
View file

@ -5050,6 +5050,7 @@ dependencies = [
"derive_more",
"fxhash",
"log",
"new_debug_unreachable",
"phf",
"phf_codegen",
"precomputed-hash",

View file

@ -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" }

View file

@ -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")
},
}
}