mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +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
|
@ -50,7 +50,7 @@ fn parse_counters<'i, 't>(
|
|||
default_value: i32,
|
||||
) -> Result<Vec<CounterPair<Integer>>, ParseError<'i>> {
|
||||
if input
|
||||
.try(|input| input.expect_ident_matching("none"))
|
||||
.try_parse(|input| input.expect_ident_matching("none"))
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(vec![]);
|
||||
|
@ -69,7 +69,7 @@ fn parse_counters<'i, 't>(
|
|||
};
|
||||
|
||||
let value = input
|
||||
.try(|input| Integer::parse(context, input))
|
||||
.try_parse(|input| Integer::parse(context, input))
|
||||
.unwrap_or(Integer::new(default_value));
|
||||
counters.push(CounterPair { name, value });
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ impl Content {
|
|||
#[cfg(feature = "servo")]
|
||||
fn parse_counter_style(_: &ParserContext, input: &mut Parser) -> ListStyleType {
|
||||
input
|
||||
.try(|input| {
|
||||
.try_parse(|input| {
|
||||
input.expect_comma()?;
|
||||
ListStyleType::parse(input)
|
||||
})
|
||||
|
@ -101,7 +101,7 @@ impl Content {
|
|||
#[cfg(feature = "gecko")]
|
||||
fn parse_counter_style(context: &ParserContext, input: &mut Parser) -> CounterStyle {
|
||||
input
|
||||
.try(|input| {
|
||||
.try_parse(|input| {
|
||||
input.expect_comma()?;
|
||||
CounterStyle::parse(context, input)
|
||||
})
|
||||
|
@ -119,13 +119,13 @@ impl Parse for Content {
|
|||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if input
|
||||
.try(|input| input.expect_ident_matching("normal"))
|
||||
.try_parse(|input| input.expect_ident_matching("normal"))
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(generics::Content::Normal);
|
||||
}
|
||||
if input
|
||||
.try(|input| input.expect_ident_matching("none"))
|
||||
.try_parse(|input| input.expect_ident_matching("none"))
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(generics::Content::None);
|
||||
|
@ -136,7 +136,7 @@ impl Parse for Content {
|
|||
loop {
|
||||
#[cfg(any(feature = "gecko", feature = "servo-layout-2020"))]
|
||||
{
|
||||
if let Ok(url) = input.try(|i| SpecifiedImageUrl::parse(context, i)) {
|
||||
if let Ok(url) = input.try_parse(|i| SpecifiedImageUrl::parse(context, i)) {
|
||||
content.push(generics::ContentItem::Url(url));
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue