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/src/commands/require.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'crates/mozart/src/commands/require.rs') diff --git a/crates/mozart/src/commands/require.rs b/crates/mozart/src/commands/require.rs index 22f7a8d..3ccba96 100644 --- a/crates/mozart/src/commands/require.rs +++ b/crates/mozart/src/commands/require.rs @@ -949,9 +949,7 @@ pub async fn execute( console_writeln!( console, - &console_format!( - "Using version constraint for {name} from Packagist..." - ), + "Using version constraint for {name} from Packagist..." ); let best = version_selector @@ -970,7 +968,7 @@ pub async fn execute( console_writeln!( console, - &console_format!("Using version {constraint} for {name}"), + "Using version {constraint} for {name}", ); (name, constraint) @@ -1031,15 +1029,12 @@ pub async fn execute( if let Some(existing) = target.get(name) { console_writeln!( console, - &console_format!( - "Updating {name} from {existing} to {constraint} \ - in {section_name}" - ), + "Updating {name} from {existing} to {constraint} in {section_name}", ); } else { console_writeln!( console, - &console_format!("Adding {name} ({constraint}) to {section_name}"), + "Adding {name} ({constraint}) to {section_name}", ); } @@ -1067,7 +1062,7 @@ pub async fn execute( if args.dry_run { console_writeln!( console, - &console_format!("Dry run: composer.json not modified."), + "Dry run: composer.json not modified.", ); } else { update_file(&composer_path, &raw)?; @@ -1085,9 +1080,7 @@ pub async fn execute( if args.no_update { console_writeln!( console, - &console_format!( - "Not updating dependencies, only modifying composer.json." - ), + "Not updating dependencies, only modifying composer.json." ); return Ok(()); } -- cgit v1.3.1