mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
921987048c
commit
653245c94e
1 changed files with 13 additions and 16 deletions
|
@ -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))
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue