Skip to content

Commit

Permalink
Defer is_syn_full() call until first expression
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 4, 2024
1 parent c92ac99 commit 7daf1b1
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 7daf1b1

Please sign in to comment.