refactor(runner): Phase 105.5 Console出力のmacro統一化

- Replace direct console.println() calls with console_println! macro
- Simplify error handling in vm.rs (RC output)
- Simplify success logging in selfhost.rs (PluginHost init)
- Remove redundant nested if-let structures for Option handling
- Macro already handles all fallback scenarios (eprintln!)

This reduces code duplication and improves consistency. The macro
centralizes the fallback logic, making it easier to maintain.

Files modified:
- src/runner/modes/vm.rs (simplified RC output)
- src/runner/selfhost.rs (simplified PluginHost init message)

Line reduction: ~13 lines (nested if-let structures removed)
This commit is contained in:
nyash-codex
2025-12-03 14:25:28 +09:00
parent 8203882a97
commit ea4c164dae
2 changed files with 5 additions and 18 deletions

View File

@ -586,17 +586,8 @@ impl NyashRunner {
// Quiet mode: suppress "RC:" output for JSON-only pipelines
if !quiet_pipe {
// Phase 98: ConsoleService if available, otherwise eprintln
// Phase 103: Handle Option<Arc<dyn ConsoleService>>
if let Some(host) = crate::runtime::try_get_core_plugin_host() {
if let Some(ref console) = host.core.console {
console.println(&format!("RC: {}", exit_code));
} else {
println!("RC: {}", exit_code);
}
} else {
println!("RC: {}", exit_code);
}
// Phase 105.5: Unified console output via macro
crate::console_println!("RC: {}", exit_code);
}
if std::env::var("NYASH_EMIT_MIR_TRACE")
.ok()