mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
style: Switch all callsites of try() to try_parse() in the style crate.
Fully automated via: $ rg -l '\.try\(' | xargs sed -i 's/\.try(/.try_parse(/g' $ cd servo/components/style && cargo +nightly fmt Differential Revision: https://phabricator.services.mozilla.com/D80099
This commit is contained in:
parent
5af0d7ca7c
commit
685e749cfc
56 changed files with 469 additions and 403 deletions
|
@ -267,7 +267,7 @@ fn parse_shorthand<'i, 't>(
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<(ViewportLength, ViewportLength), ParseError<'i>> {
|
||||
let min = ViewportLength::parse(context, input)?;
|
||||
match input.try(|i| ViewportLength::parse(context, i)) {
|
||||
match input.try_parse(|i| ViewportLength::parse(context, i)) {
|
||||
Err(_) => Ok((min.clone(), min)),
|
||||
Ok(max) => Ok((min, max)),
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> {
|
|||
($declaration:ident($parse:expr)) => {
|
||||
declaration!($declaration {
|
||||
value: $parse(input)?,
|
||||
important: input.try(parse_important).is_ok(),
|
||||
important: input.try_parse(parse_important).is_ok(),
|
||||
})
|
||||
};
|
||||
($declaration:ident { value: $value:expr, important: $important:expr, }) => {
|
||||
|
@ -311,7 +311,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> {
|
|||
};
|
||||
(shorthand -> [$min:ident, $max:ident]) => {{
|
||||
let shorthand = parse_shorthand(self.context, input)?;
|
||||
let important = input.try(parse_important).is_ok();
|
||||
let important = input.try_parse(parse_important).is_ok();
|
||||
|
||||
Ok(vec![
|
||||
declaration!($min {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue