diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-09 12:15:21 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-09 12:15:53 +0900 |
| commit | f18c18cd15f180b5067069ec6f10530515715f3d (patch) | |
| tree | 85ea3d3f10da9b32359dc3797fc7e6d262ae6752 /crates/mozart/src/commands/require.rs | |
| parent | f0192390ae1d89981f59395307e885a595f86eef (diff) | |
| download | php-mozart-f18c18cd15f180b5067069ec6f10530515715f3d.tar.gz php-mozart-f18c18cd15f180b5067069ec6f10530515715f3d.tar.zst php-mozart-f18c18cd15f180b5067069ec6f10530515715f3d.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/require.rs')
| -rw-r--r-- | crates/mozart/src/commands/require.rs | 19 |
1 files changed, 6 insertions, 13 deletions
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!( - "<info>Using version constraint for {name} from Packagist...</info>" - ), + "<info>Using version constraint for {name} from Packagist...</info>" ); let best = version_selector @@ -970,7 +968,7 @@ pub async fn execute( console_writeln!( console, - &console_format!("<info>Using version {constraint} for {name}</info>"), + "<info>Using version {constraint} for {name}</info>", ); (name, constraint) @@ -1031,15 +1029,12 @@ pub async fn execute( if let Some(existing) = target.get(name) { console_writeln!( console, - &console_format!( - "<comment>Updating {name} from {existing} to {constraint} \ - in {section_name}</comment>" - ), + "<comment>Updating {name} from {existing} to {constraint} in {section_name}</comment>", ); } else { console_writeln!( console, - &console_format!("<info>Adding {name} ({constraint}) to {section_name}</info>"), + "<info>Adding {name} ({constraint}) to {section_name}</info>", ); } @@ -1067,7 +1062,7 @@ pub async fn execute( if args.dry_run { console_writeln!( console, - &console_format!("<comment>Dry run: composer.json not modified.</comment>"), + "<comment>Dry run: composer.json not modified.</comment>", ); } else { update_file(&composer_path, &raw)?; @@ -1085,9 +1080,7 @@ pub async fn execute( if args.no_update { console_writeln!( console, - &console_format!( - "<comment>Not updating dependencies, only modifying composer.json.</comment>" - ), + "<comment>Not updating dependencies, only modifying composer.json.</comment>" ); return Ok(()); } |
