mirror of
https://github.com/servo/servo.git
synced 2025-08-14 09:55:35 +01:00
style: Revert try -> r#try change.
Since we're in an inconsistent state because mako files weren't updated, and it's really really ugly.
This commit is contained in:
parent
155caba595
commit
212b3e1311
47 changed files with 326 additions and 336 deletions
|
@ -103,7 +103,7 @@ impl SupportsCondition {
|
|||
///
|
||||
/// <https://drafts.csswg.org/css-conditional/#supports_condition>
|
||||
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
if input.r#try(|i| i.expect_ident_matching("not")).is_ok() {
|
||||
if input.try(|i| i.expect_ident_matching("not")).is_ok() {
|
||||
let inner = SupportsCondition::parse_in_parens(input)?;
|
||||
return Ok(SupportsCondition::Not(Box::new(inner)));
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ impl SupportsCondition {
|
|||
loop {
|
||||
conditions.push(SupportsCondition::parse_in_parens(input)?);
|
||||
if input
|
||||
.r#try(|input| input.expect_ident_matching(keyword))
|
||||
.try(|input| input.expect_ident_matching(keyword))
|
||||
.is_err()
|
||||
{
|
||||
// Did not find the expected keyword.
|
||||
|
@ -175,20 +175,20 @@ impl SupportsCondition {
|
|||
fn parse_in_parens<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
// Whitespace is normally taken care of in `Parser::next`,
|
||||
// but we want to not include it in `pos` for the SupportsCondition::FutureSyntax cases.
|
||||
while input.r#try(Parser::expect_whitespace).is_ok() {}
|
||||
while input.try(Parser::expect_whitespace).is_ok() {}
|
||||
let pos = input.position();
|
||||
let location = input.current_source_location();
|
||||
// FIXME: remove clone() when lifetimes are non-lexical
|
||||
match input.next()?.clone() {
|
||||
Token::ParenthesisBlock => {
|
||||
let nested =
|
||||
input.r#try(|input| input.parse_nested_block(parse_condition_or_declaration));
|
||||
input.try(|input| input.parse_nested_block(parse_condition_or_declaration));
|
||||
if nested.is_ok() {
|
||||
return nested;
|
||||
}
|
||||
},
|
||||
Token::Function(ident) => {
|
||||
let nested = input.r#try(|input| {
|
||||
let nested = input.try(|input| {
|
||||
input.parse_nested_block(|input| {
|
||||
SupportsCondition::parse_functional(&ident, input)
|
||||
})
|
||||
|
@ -240,7 +240,7 @@ fn eval_moz_bool_pref(_: &CStr, _: &ParserContext) -> bool {
|
|||
pub fn parse_condition_or_declaration<'i, 't>(
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<SupportsCondition, ParseError<'i>> {
|
||||
if let Ok(condition) = input.r#try(SupportsCondition::parse) {
|
||||
if let Ok(condition) = input.try(SupportsCondition::parse) {
|
||||
Ok(SupportsCondition::Parenthesized(Box::new(condition)))
|
||||
} else {
|
||||
Declaration::parse(input).map(SupportsCondition::Declaration)
|
||||
|
@ -418,7 +418,7 @@ impl Declaration {
|
|||
PropertyDeclaration::parse_into(&mut declarations, id, &context, input)
|
||||
.map_err(|_| input.new_custom_error(()))
|
||||
})?;
|
||||
let _ = input.r#try(parse_important);
|
||||
let _ = input.try(parse_important);
|
||||
Ok(())
|
||||
})
|
||||
.is_ok()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue