Implement Selector::new() utility function
This commit is contained in:
parent
2c38db8703
commit
cacf8c41ab
@ -337,7 +337,7 @@ impl<'a> StyleSheetParser<'a> {
|
||||
| TokenKind::Symbol(Symbol::Mul)
|
||||
| TokenKind::Symbol(Symbol::Percent)
|
||||
| TokenKind::Symbol(Symbol::Period) => rules
|
||||
.extend(self.eat_rules(&Selector(Vec::new()), &mut self.global_scope.clone())?),
|
||||
.extend(self.eat_rules(&Selector::new(), &mut self.global_scope.clone())?),
|
||||
TokenKind::Whitespace(_) => {
|
||||
self.lexer.next();
|
||||
continue;
|
||||
@ -382,7 +382,7 @@ impl<'a> StyleSheetParser<'a> {
|
||||
TokenKind::AtRule(AtRuleKind::Include) => rules.extend(eat_include(
|
||||
&mut self.lexer,
|
||||
&self.global_scope,
|
||||
&Selector(Vec::new()),
|
||||
&Selector::new(),
|
||||
)?),
|
||||
TokenKind::AtRule(AtRuleKind::Import) => {
|
||||
let Token { pos, .. } = self
|
||||
|
@ -12,6 +12,12 @@ use std::vec::IntoIter;
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub(crate) struct Selector(pub Vec<SelectorKind>);
|
||||
|
||||
impl Selector {
|
||||
pub fn new() -> Selector {
|
||||
Selector(Vec::new())
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Selector {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut iter = self.0.iter().peekable();
|
||||
|
Loading…
x
Reference in New Issue
Block a user