Skip to content

Commit fa46b86

Browse files
committed
refactor: simplify error handling in dotenv loading
1 parent 567841e commit fa46b86

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/agent/runloop/unified/diagnostics.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,11 @@ pub(crate) async fn run_doctor_diagnostics(
125125
render_doctor_check(
126126
renderer,
127127
" HITL Enabled",
128-
Ok(format!(
129-
"{}",
130-
if cfg.security.human_in_the_loop {
128+
Ok((if cfg.security.human_in_the_loop {
131129
"Yes"
132130
} else {
133131
"No"
134-
}
135-
)),
132+
}).to_string()),
136133
)?;
137134

138135
// Tool default policy
@@ -147,7 +144,7 @@ pub(crate) async fn run_doctor_diagnostics(
147144
render_doctor_check(
148145
renderer,
149146
" PTY Enabled",
150-
Ok(format!("{}", if cfg.pty.enabled { "Yes" } else { "No" })),
147+
Ok((if cfg.pty.enabled { "Yes" } else { "No" }).to_string()),
151148
)?;
152149
}
153150

src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ async fn run() -> Result<()> {
5757
panic_hook::set_debug_mode(args.debug);
5858

5959
// Load .env (non-fatal if missing)
60-
if let Err(err) = load_dotenv() {
61-
if !args.quiet {
60+
if let Err(err) = load_dotenv()
61+
&& !args.quiet {
6262
eprintln!("vtcode: warning: failed to load .env: {err}");
6363
}
64-
}
6564

6665
process_hardening::apply_process_hardening()
6766
.context("failed to apply process hardening safeguards")?;

0 commit comments

Comments
 (0)