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:
Emilio Cobos Álvarez 2020-06-17 22:27:37 +00:00
parent 5af0d7ca7c
commit 685e749cfc
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
56 changed files with 469 additions and 403 deletions

View file

@ -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 {