mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +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
|
@ -369,7 +369,7 @@ impl Parse for System {
|
|||
"symbolic" => Ok(System::Symbolic),
|
||||
"additive" => Ok(System::Additive),
|
||||
"fixed" => {
|
||||
let first_symbol_value = input.try(|i| Integer::parse(context, i)).ok();
|
||||
let first_symbol_value = input.try_parse(|i| Integer::parse(context, i)).ok();
|
||||
Ok(System::Fixed { first_symbol_value })
|
||||
},
|
||||
"extends" => {
|
||||
|
@ -458,7 +458,7 @@ impl Parse for Negative {
|
|||
) -> Result<Self, ParseError<'i>> {
|
||||
Ok(Negative(
|
||||
Symbol::parse(context, input)?,
|
||||
input.try(|input| Symbol::parse(context, input)).ok(),
|
||||
input.try_parse(|input| Symbol::parse(context, input)).ok(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ impl Parse for CounterRanges {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input
|
||||
.try(|input| input.expect_ident_matching("auto"))
|
||||
.try_parse(|input| input.expect_ident_matching("auto"))
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(CounterRanges(Default::default()));
|
||||
|
@ -519,7 +519,7 @@ fn parse_bound<'i, 't>(
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<CounterBound, ParseError<'i>> {
|
||||
if let Ok(integer) = input.try(|input| Integer::parse(context, input)) {
|
||||
if let Ok(integer) = input.try_parse(|input| Integer::parse(context, input)) {
|
||||
return Ok(CounterBound::Integer(integer));
|
||||
}
|
||||
input.expect_ident_matching("infinite")?;
|
||||
|
@ -535,7 +535,7 @@ impl Parse for Pad {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let pad_with = input.try(|input| Symbol::parse(context, input));
|
||||
let pad_with = input.try_parse(|input| Symbol::parse(context, input));
|
||||
let min_length = Integer::parse_non_negative(context, input)?;
|
||||
let pad_with = pad_with.or_else(|_| Symbol::parse(context, input))?;
|
||||
Ok(Pad(min_length, pad_with))
|
||||
|
@ -568,7 +568,7 @@ impl Parse for Symbols {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let mut symbols = Vec::new();
|
||||
while let Ok(s) = input.try(|input| Symbol::parse(context, input)) {
|
||||
while let Ok(s) = input.try_parse(|input| Symbol::parse(context, input)) {
|
||||
symbols.push(s);
|
||||
}
|
||||
if symbols.is_empty() {
|
||||
|
@ -618,7 +618,7 @@ impl Parse for AdditiveTuple {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let symbol = input.try(|input| Symbol::parse(context, input));
|
||||
let symbol = input.try_parse(|input| Symbol::parse(context, input));
|
||||
let weight = Integer::parse_non_negative(context, input)?;
|
||||
let symbol = symbol.or_else(|_| Symbol::parse(context, input))?;
|
||||
Ok(Self { weight, symbol })
|
||||
|
@ -648,7 +648,7 @@ impl Parse for SpeakAs {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
let mut is_spell_out = false;
|
||||
let result = input.try(|input| {
|
||||
let result = input.try_parse(|input| {
|
||||
let ident = input.expect_ident().map_err(|_| ())?;
|
||||
match_ignore_ascii_case! { &*ident,
|
||||
"auto" => Ok(SpeakAs::Auto),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue