Skip to content

Commit

Permalink
impl Parse for MethodTurbofish
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 5, 2022
1 parent e1ffb07 commit 6ae1c80
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1603,27 +1603,7 @@ pub(crate) mod parsing {

let member: Member = input.parse()?;
let turbofish = if member.is_named() && input.peek(Token![::]) {
Some(MethodTurbofish {
colon2_token: input.parse()?,
lt_token: input.parse()?,
args: {
let mut args = Punctuated::new();
loop {
if input.peek(Token![>]) {
break;
}
let value: GenericMethodArgument = input.parse()?;
args.push_value(value);
if input.peek(Token![>]) {
break;
}
let punct = input.parse()?;
args.push_punct(punct);
}
args
},
gt_token: input.parse()?,
})
Some(input.parse::<MethodTurbofish>()?)
} else {
None
};
Expand Down Expand Up @@ -2116,6 +2096,34 @@ pub(crate) mod parsing {
}
}

#[cfg(feature = "full")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for MethodTurbofish {
fn parse(input: ParseStream) -> Result<Self> {
Ok(MethodTurbofish {
colon2_token: input.parse()?,
lt_token: input.parse()?,
args: {
let mut args = Punctuated::new();
loop {
if input.peek(Token![>]) {
break;
}
let value: GenericMethodArgument = input.parse()?;
args.push_value(value);
if input.peek(Token![>]) {
break;
}
let punct = input.parse()?;
args.push_punct(punct);
}
args
},
gt_token: input.parse()?,
})
}
}

#[cfg(feature = "full")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprLet {
Expand Down

0 comments on commit 6ae1c80

Please sign in to comment.