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/repository.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/repository.rs')
| -rw-r--r-- | crates/mozart/src/commands/repository.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/mozart/src/commands/repository.rs b/crates/mozart/src/commands/repository.rs index 27c822c..3905c77 100644 --- a/crates/mozart/src/commands/repository.rs +++ b/crates/mozart/src/commands/repository.rs @@ -104,7 +104,7 @@ fn list_repositories( && let Some((key, val)) = obj.iter().next() && val == &serde_json::Value::Bool(false) { - console_writeln!(console, &format!("[{key}] disabled")); + console_writeln!(console, "[{key}] disabled"); continue; } @@ -118,7 +118,7 @@ fn list_repositories( .unwrap_or("unknown"); let url = entry.get("url").map(render_value).unwrap_or_default(); - console_writeln!(console, &format!("[{name}] {repo_type} {url}")); + console_writeln!(console, "[{name}] {repo_type} {url}"); } Ok(()) @@ -223,7 +223,7 @@ fn execute_get_url( // Assoc-keyed fast path (mirrors Composer's `isset($repos[$name])` check). if let Some(repo) = repos_raw.as_object().and_then(|obj| obj.get(name)) { if let Some(url) = repo.get("url").and_then(|u| u.as_str()) { - console_writeln!(console, url); + console_writeln!(console, "{}", url); return Ok(()); } anyhow::bail!("The {} repository does not have a URL", name); @@ -234,7 +234,7 @@ fn execute_get_url( for repo in &repos { if repo.get("name").and_then(|n| n.as_str()) == Some(name) { if let Some(url) = repo.get("url").and_then(|u| u.as_str()) { - console_writeln!(console, url); + console_writeln!(console, "{}", url); return Ok(()); } anyhow::bail!("The {} repository does not have a URL", name); |
