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/check_platform_reqs.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/check_platform_reqs.rs')
| -rw-r--r-- | crates/mozart/src/commands/check_platform_reqs.rs | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/crates/mozart/src/commands/check_platform_reqs.rs b/crates/mozart/src/commands/check_platform_reqs.rs index c8dadf9..1a10882 100644 --- a/crates/mozart/src/commands/check_platform_reqs.rs +++ b/crates/mozart/src/commands/check_platform_reqs.rs @@ -1,6 +1,5 @@ use clap::Args; use mozart_core::console::Console; -use mozart_core::console_format; use mozart_core::console_writeln; use mozart_core::console_writeln_error; use mozart_core::installer::{InstalledCandidate, InstalledRepoLite}; @@ -84,10 +83,8 @@ pub async fn execute( } console_writeln_error!( console, - &console_format!( - "<info>Checking {}platform requirements using the lock file</info>", - dev_text - ), + "<info>Checking {}platform requirements using the lock file</info>", + dev_text, ); load_lock(&lock_path, args.no_dev, &mut installed_repo, &mut requires)?; } else { @@ -100,19 +97,15 @@ pub async fn execute( let installed = mozart_registry::installed::InstalledPackages::read(&vendor_dir)?; console_writeln_error!( console, - &console_format!( - "<info>Checking {}platform requirements for packages in the vendor dir</info>", - dev_text - ), + "<info>Checking {}platform requirements for packages in the vendor dir</info>", + dev_text, ); load_installed(&installed, args.no_dev, &mut installed_repo, &mut requires); } else { console_writeln_error!( console, - &console_format!( - "<warning>No vendor dir present, checking {}platform requirements from the lock file</warning>", - dev_text - ), + "<warning>No vendor dir present, checking {}platform requirements from the lock file</warning>", + dev_text, ); if lock_path.exists() { load_lock(&lock_path, args.no_dev, &mut installed_repo, &mut requires)?; @@ -406,7 +399,7 @@ fn print_table(results: &[CheckRow], format: &str, console: &Console) -> anyhow: }) }) .collect(); - console_writeln!(console, &serde_json::to_string_pretty(&rows)?); + console_writeln!(console, "{}", &serde_json::to_string_pretty(&rows)?); return Ok(()); } @@ -446,25 +439,19 @@ fn print_table(results: &[CheckRow], format: &str, console: &Console) -> anyhow: Status::Success => { console_writeln!( console, - &console_format!( - "<info>{padded_name}</info> <comment>{padded_version}</comment> {link_text} <info>success</info>{provider_suffix}", - ), + "<info>{padded_name}</info> <comment>{padded_version}</comment> {link_text} <info>success</info>{provider_suffix}", ); } Status::Failed => { console_writeln!( console, - &console_format!( - "<comment>{padded_name}</comment> <comment>{padded_version}</comment> {link_text} <error>failed</error>{provider_suffix}", - ), + "<comment>{padded_name}</comment> <comment>{padded_version}</comment> {link_text} <error>failed</error>{provider_suffix}", ); } Status::Missing => { console_writeln!( console, - &console_format!( - "<comment>{padded_name}</comment> <comment>{padded_version}</comment> {link_text} <error>missing</error>{provider_suffix}", - ), + "<comment>{padded_name}</comment> <comment>{padded_version}</comment> {link_text} <error>missing</error>{provider_suffix}", ); } } |
