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/self_update.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/self_update.rs')
| -rw-r--r-- | crates/mozart/src/commands/self_update.rs | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/crates/mozart/src/commands/self_update.rs b/crates/mozart/src/commands/self_update.rs index d5ddda0..a326914 100644 --- a/crates/mozart/src/commands/self_update.rs +++ b/crates/mozart/src/commands/self_update.rs @@ -1,6 +1,5 @@ use clap::Args; use mozart_core::MOZART_VERSION; -use mozart_core::console_format; use mozart_core::console_writeln; use std::io::Write; use std::path::{Path, PathBuf}; @@ -280,19 +279,14 @@ async fn update( if args.version.is_none() && target_version == current_version { console_writeln!( console, - &console_format!( - "<info>You are already using the latest available Mozart version {current_version} ({channel} channel).</info>" - ), + "<info>You are already using the latest available Mozart version {current_version} ({channel} channel).</info>" ); if args.clean_backups { // Preserve the most recent backup let latest = find_latest_backup(data_dir).ok(); clean_backups(data_dir, latest.as_deref())?; - console_writeln!( - console, - &console_format!("<comment>Old backups removed.</comment>"), - ); + console_writeln!(console, "<comment>Old backups removed.</comment>"); } return Ok(()); @@ -349,9 +343,7 @@ async fn update( console_writeln!( console, - &console_format!( - "<info>Mozart updated successfully from {current_version} to {target_version}</info>" - ), + "<info>Mozart updated successfully from {current_version} to {target_version}</info>" ); console.info(&format!( "Use `mozart self-update --rollback` to return to version {current_version}" @@ -359,10 +351,7 @@ async fn update( if args.clean_backups { clean_backups(data_dir, Some(&backup_path))?; - console_writeln!( - console, - &console_format!("<comment>Old backups removed.</comment>"), - ); + console_writeln!(console, "<comment>Old backups removed.</comment>"); } Ok(()) @@ -393,7 +382,7 @@ fn rollback( console_writeln!( console, - &console_format!("<info>Rollback successful. Restored version {backup_version}</info>"), + "<info>Rollback successful. Restored version {backup_version}</info>", ); let _ = current_exe; // suppress unused warning |
