fix: collapse nested if-let blocks to satisfy clippy collapsible_if lint

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dave
2026-04-12 11:43:36 +00:00
parent 0b58b0486c
commit 06defd9596
2 changed files with 15 additions and 16 deletions
+10 -11
View File
@@ -201,19 +201,18 @@ pub(in crate::agents::pool) async fn run_server_owned_completion(
// Kill any in-flight cargo test processes for this worktree so they don't
// hold the build lock while gates try to run.
if let Some(wt_path) = worktree_path.as_ref() {
if let Ok(output) = std::process::Command::new("pgrep")
if let Some(wt_path) = worktree_path.as_ref()
&& let Ok(output) = std::process::Command::new("pgrep")
.args(["-f", &format!("--manifest-path {}/Cargo.toml", wt_path.display())])
.output()
{
let pids = String::from_utf8_lossy(&output.stdout);
for pid_str in pids.lines() {
if let Ok(pid) = pid_str.trim().parse::<i32>() {
crate::slog!(
"[agents] Killing stale cargo process (pid {pid}) for '{story_id}' before running gates"
);
unsafe { libc::kill(pid, libc::SIGKILL); }
}
{
let pids = String::from_utf8_lossy(&output.stdout);
for pid_str in pids.lines() {
if let Ok(pid) = pid_str.trim().parse::<i32>() {
crate::slog!(
"[agents] Killing stale cargo process (pid {pid}) for '{story_id}' before running gates"
);
unsafe { libc::kill(pid, libc::SIGKILL); }
}
}
}
+5 -5
View File
@@ -399,11 +399,11 @@ pub(super) async fn tool_run_tests(args: &Value, ctx: &AppContext) -> Result<Str
// Kill any existing test job for this worktree.
{
let mut jobs = ctx.test_jobs.lock().map_err(|e| e.to_string())?;
if let Some(mut old_job) = jobs.remove(&working_dir) {
if let Some(ref mut child) = old_job.child {
let _ = child.kill();
let _ = child.wait();
}
if let Some(mut old_job) = jobs.remove(&working_dir)
&& let Some(ref mut child) = old_job.child
{
let _ = child.kill();
let _ = child.wait();
}
}