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
|
@ -22,9 +22,10 @@ impl Parse for BackgroundSize {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(width) = input.try(|i| NonNegativeLengthPercentageOrAuto::parse(context, i)) {
|
||||
if let Ok(width) = input.try_parse(|i| NonNegativeLengthPercentageOrAuto::parse(context, i))
|
||||
{
|
||||
let height = input
|
||||
.try(|i| NonNegativeLengthPercentageOrAuto::parse(context, i))
|
||||
.try_parse(|i| NonNegativeLengthPercentageOrAuto::parse(context, i))
|
||||
.unwrap_or(NonNegativeLengthPercentageOrAuto::auto());
|
||||
return Ok(GenericBackgroundSize::ExplicitSize { width, height });
|
||||
}
|
||||
|
@ -136,7 +137,7 @@ impl Parse for BackgroundRepeat {
|
|||
},
|
||||
};
|
||||
|
||||
let vertical = input.try(BackgroundRepeatKeyword::parse).ok();
|
||||
let vertical = input.try_parse(BackgroundRepeatKeyword::parse).ok();
|
||||
Ok(BackgroundRepeat(horizontal, vertical.unwrap_or(horizontal)))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue