From 7daf1b169d4daed1f2d2765b36726a0ddc29c01c Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 4 Nov 2024 11:29:37 -0500 Subject: [PATCH] Defer is_syn_full() call until first expression --- impl/src/fmt.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/impl/src/fmt.rs b/impl/src/fmt.rs index 1fc290e..f63fa68 100644 --- a/impl/src/fmt.rs +++ b/impl/src/fmt.rs @@ -138,7 +138,7 @@ fn explicit_named_args(input: ParseStream) -> Result> { } fn try_explicit_named_args(input: ParseStream) -> Result> { - let syn_full = is_syn_full(); + let mut syn_full = None; let mut named_args = Set::new(); while !input.is_empty() { @@ -151,7 +151,7 @@ fn try_explicit_named_args(input: ParseStream) -> Result> { input.parse::()?; named_args.insert(ident); } - if syn_full { + if *syn_full.get_or_insert_with(is_syn_full) { let ahead = input.fork(); if ahead.parse::().is_ok() { input.advance_to(&ahead);