Skip to content

Commit

Permalink
Merge pull request #342 from dtolnay/synfull
Browse files Browse the repository at this point in the history
Defer is_syn_full() call until first expression
  • Loading branch information
dtolnay authored Nov 4, 2024
2 parents c92ac99 + 7daf1b1 commit 490f9c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions impl/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fn explicit_named_args(input: ParseStream) -> Result<Set<Ident>> {
}

fn try_explicit_named_args(input: ParseStream) -> Result<Set<Ident>> {
let syn_full = is_syn_full();
let mut syn_full = None;
let mut named_args = Set::new();

while !input.is_empty() {
Expand All @@ -151,7 +151,7 @@ fn try_explicit_named_args(input: ParseStream) -> Result<Set<Ident>> {
input.parse::<Token![=]>()?;
named_args.insert(ident);
}
if syn_full {
if *syn_full.get_or_insert_with(is_syn_full) {
let ahead = input.fork();
if ahead.parse::<Expr>().is_ok() {
input.advance_to(&ahead);
Expand Down

0 comments on commit 490f9c0

Please sign in to comment.