Skip to content

Commit e495407

Browse files
committed
fix(core): convert if to match guard to satisfy clippy collapsible_match
1 parent 4afd8ca commit e495407

1 file changed

Lines changed: 30 additions & 30 deletions

File tree

core/src/llm/anthropic.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -436,37 +436,37 @@ impl LlmClient for AnthropicClient {
436436
.await;
437437
}
438438
},
439-
AnthropicStreamEvent::ContentBlockStop { index: _ } => {
440-
if !current_tool_id.is_empty() {
441-
let input: serde_json::Value = if current_tool_input
442-
.trim()
443-
.is_empty()
444-
{
445-
serde_json::Value::Object(Default::default())
446-
} else {
447-
serde_json::from_str(&current_tool_input)
448-
.unwrap_or_else(|e| {
449-
tracing::warn!(
450-
"Failed to parse tool input JSON for tool '{}': {}",
451-
current_tool_name, e
452-
);
453-
serde_json::json!({
454-
"__parse_error": format!(
455-
"Malformed tool arguments: {}. Raw input: {}",
456-
e, &current_tool_input
457-
)
458-
})
439+
AnthropicStreamEvent::ContentBlockStop { index: _ }
440+
if !current_tool_id.is_empty() =>
441+
{
442+
let input: serde_json::Value = if current_tool_input
443+
.trim()
444+
.is_empty()
445+
{
446+
serde_json::Value::Object(Default::default())
447+
} else {
448+
serde_json::from_str(&current_tool_input)
449+
.unwrap_or_else(|e| {
450+
tracing::warn!(
451+
"Failed to parse tool input JSON for tool '{}': {}",
452+
current_tool_name, e
453+
);
454+
serde_json::json!({
455+
"__parse_error": format!(
456+
"Malformed tool arguments: {}. Raw input: {}",
457+
e, &current_tool_input
458+
)
459459
})
460-
};
461-
content_blocks.push(ContentBlock::ToolUse {
462-
id: current_tool_id.clone(),
463-
name: current_tool_name.clone(),
464-
input,
465-
});
466-
current_tool_id.clear();
467-
current_tool_name.clear();
468-
current_tool_input.clear();
469-
}
460+
})
461+
};
462+
content_blocks.push(ContentBlock::ToolUse {
463+
id: current_tool_id.clone(),
464+
name: current_tool_name.clone(),
465+
input,
466+
});
467+
current_tool_id.clear();
468+
current_tool_name.clear();
469+
current_tool_input.clear();
470470
}
471471
AnthropicStreamEvent::MessageStart { message } => {
472472
response_id = message.id;

0 commit comments

Comments
 (0)