From f18c18cd15f180b5067069ec6f10530515715f3d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 9 May 2026 12:15:21 +0900 Subject: refactor(console): accept format args directly in console_writeln! macros Eliminate the nested &console_format!(...) boilerplate at every call site by teaching console_writeln!, console_write!, console_writeln_error!, and console_write_error! to accept a format literal + variadic args directly, matching the println!/eprintln! ergonomics. Propagate the format string span into generated code so rustc errors point to the right location. Co-Authored-By: Claude Sonnet 4.6 --- crates/mozart-console-macros/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/mozart-console-macros/src/lib.rs') diff --git a/crates/mozart-console-macros/src/lib.rs b/crates/mozart-console-macros/src/lib.rs index 3af6f82..0678ecd 100644 --- a/crates/mozart-console-macros/src/lib.rs +++ b/crates/mozart-console-macros/src/lib.rs @@ -39,7 +39,11 @@ fn console_format_impl( let args: ConsoleFormatArgs = syn::parse2(input)?; let segments = parser::parse_format_string(&args.format_str) .map_err(|msg| syn::Error::new(args.format_str_span, msg))?; - Ok(codegen::generate(&segments, &args.extra_args)) + Ok(codegen::generate( + &segments, + &args.extra_args, + args.format_str_span, + )) } struct ConsoleFormatArgs { -- cgit v1.3.1