refactor(core): collapse nested if statements per clippy

Collapsed nested if statements that check related conditions into
single conditions using &&. This improves readability by making
the logical relationship between conditions explicit.

Files changed:
- feedback_extraction.rs: 3 instances of tool_use/final_output checks
- tools/todo.rs: 1 instance of todo completion check

Agent: fowler
This commit is contained in:
Dhanji R. Prasanna
2026-01-11 16:21:33 +05:30
parent 1c3de60bb9
commit 874be7b459
2 changed files with 30 additions and 31 deletions

View File

@@ -92,24 +92,23 @@ pub async fn execute_todo_write<W: UiWriter>(
if !in_planner_mode
&& !has_incomplete
&& (content_str.contains("- [x]") || content_str.contains("- [X]"))
&& todo_path.exists()
{
if todo_path.exists() {
match std::fs::remove_file(&todo_path) {
Ok(_) => {
let mut todo = ctx.todo_content.write().await;
*todo = String::new();
// Show the final completed TODOs before deletion
let mut result =
String::from("✅ All TODOs completed! Removed todo.g3.md\n\nFinal status:\n");
for line in content_str.lines() {
ctx.ui_writer.print_tool_output_line(line);
result.push_str(line);
result.push('\n');
}
return Ok(result);
match std::fs::remove_file(&todo_path) {
Ok(_) => {
let mut todo = ctx.todo_content.write().await;
*todo = String::new();
// Show the final completed TODOs before deletion
let mut result =
String::from("✅ All TODOs completed! Removed todo.g3.md\n\nFinal status:\n");
for line in content_str.lines() {
ctx.ui_writer.print_tool_output_line(line);
result.push_str(line);
result.push('\n');
}
Err(e) => return Ok(format!("❌ Failed to remove todo.g3.md: {}", e)),
return Ok(result);
}
Err(e) => return Ok(format!("❌ Failed to remove todo.g3.md: {}", e)),
}
}