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/config.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'crates/mozart/src/commands/config.rs') diff --git a/crates/mozart/src/commands/config.rs b/crates/mozart/src/commands/config.rs index 58d593a..7227556 100644 --- a/crates/mozart/src/commands/config.rs +++ b/crates/mozart/src/commands/config.rs @@ -998,8 +998,10 @@ fn execute_read( for (key, value) in config.entries() { console_writeln!( console, - &format!("[{}] {}", key, render_value(&value)), mozart_core::console::Verbosity::Quiet, + "[{}] {}", + key, + render_value(&value), ); } return Ok(()); @@ -1019,8 +1021,9 @@ fn execute_read( if entry.get("name").and_then(|n| n.as_str()) == Some(repo_name) { console_writeln!( console, - &render_value(entry), mozart_core::console::Verbosity::Quiet, + "{}", + &render_value(entry), ); return Ok(()); } @@ -1035,8 +1038,9 @@ fn execute_read( if let Some(v) = get_nested(&raw, key) { console_writeln!( console, - &render_value(v), mozart_core::console::Verbosity::Quiet, + "{}", + &render_value(v), ); return Ok(()); } @@ -1049,8 +1053,9 @@ fn execute_read( if let Some(v) = raw.get(key.as_str()) { console_writeln!( console, - &render_value(v), mozart_core::console::Verbosity::Quiet, + "{}", + &render_value(v), ); return Ok(()); } @@ -1062,8 +1067,9 @@ fn execute_read( Some(value) => { console_writeln!( console, - &render_value(&value), mozart_core::console::Verbosity::Quiet, + "{}", + &render_value(&value), ); } None => { -- cgit v1.3.1