style: Avoid some clone()s in selector parsing now that lifetimes are non-lexical

Differential Revision: https://phabricator.services.mozilla.com/D123622
This commit is contained in:
Emilio Cobos Álvarez 2021-08-30 11:08:23 +00:00 committed by Martin Robinson
parent 921987048c
commit 653245c94e

View file

@ -1878,9 +1878,9 @@ where
};
let start = input.state();
// FIXME: remove clone() when lifetimes are non-lexical
match input.next_including_whitespace().map(|t| t.clone()) {
match input.next_including_whitespace() {
Ok(Token::Ident(value)) => {
let value = value.clone();
let after_ident = input.state();
match input.next_including_whitespace() {
Ok(&Token::Delim('|')) => {
@ -1908,28 +1908,25 @@ where
},
Ok(Token::Delim('*')) => {
let after_star = input.state();
// FIXME: remove clone() when lifetimes are non-lexical
match input.next_including_whitespace().map(|t| t.clone()) {
Ok(Token::Delim('|')) => {
match input.next_including_whitespace() {
Ok(&Token::Delim('|')) => {
explicit_namespace(input, QNamePrefix::ExplicitAnyNamespace)
},
result => {
_ if !in_attr_selector => {
input.reset(&after_star);
if in_attr_selector {
match result {
Ok(t) => Err(after_star
.source_location()
.new_custom_error(SelectorParseErrorKind::ExpectedBarInAttr(t))),
Err(e) => Err(e.into()),
}
} else {
default_namespace(None)
}
default_namespace(None)
}
result => {
let t = result?;
Err(after_star
.source_location()
.new_custom_error(SelectorParseErrorKind::ExpectedBarInAttr(t.clone())))
},
}
},
Ok(Token::Delim('|')) => explicit_namespace(input, QNamePrefix::ExplicitNoNamespace),
Ok(t) => {
let t = t.clone();
input.reset(&start);
Ok(OptionalQName::None(t))
},