Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test: flatten nested if-let in tool call extraction

Steven Enamakel83b96f9d5e0d
diff --git a/tests/agent_prompt_comprehension_e2e.rs b/tests/agent_prompt_comprehension_e2e.rs
index dd605b8c44..0200d77dbd 100644
--- a/tests/agent_prompt_comprehension_e2e.rs
+++ b/tests/agent_prompt_comprehension_e2e.rs
@@ -662,10 +662,10 @@ fn called_tools(request: &Value) -> Vec<String> {
let Some((payload, after_close)) = after_open.split_once("</tool_call>") else {
break;
};
- if let Ok(call) = serde_json::from_str::<Value>(payload.trim())
- && let Some(name) = call.get("name").and_then(Value::as_str)
- {
- calls.push(name.to_string());
+ if let Ok(call) = serde_json::from_str::<Value>(payload.trim()) {
+ if let Some(name) = call.get("name").and_then(Value::as_str) {
+ calls.push(name.to_string());
+ }
}
content = after_close;
}