From cb2fdc9dbf71a2c7c7ccba69eed72200fdc4c343 Mon Sep 17 00:00:00 2001 From: Syed Hashmi Date: Tue, 21 Apr 2026 13:29:55 -0700 Subject: [PATCH] fix: silence collapsible_match clippy lint (rustc 1.95) Made-with: Cursor --- .../brightstaff/src/handlers/function_calling.rs | 6 ++---- .../src/providers/streaming_response.rs | 16 ++++++---------- crates/hermesllm/src/transforms/lib.rs | 13 ++++++------- .../src/transforms/request/from_anthropic.rs | 8 ++++---- .../src/transforms/request/from_openai.rs | 7 +++---- 5 files changed, 21 insertions(+), 29 deletions(-) diff --git a/crates/brightstaff/src/handlers/function_calling.rs b/crates/brightstaff/src/handlers/function_calling.rs index ca4def32..3e2543bc 100644 --- a/crates/brightstaff/src/handlers/function_calling.rs +++ b/crates/brightstaff/src/handlers/function_calling.rs @@ -441,10 +441,8 @@ impl ArchFunctionHandler { } } // Handle str/string conversions - "str" | "string" => { - if !value.is_string() { - return Ok(json!(value.to_string())); - } + "str" | "string" if !value.is_string() => { + return Ok(json!(value.to_string())); } _ => {} } diff --git a/crates/hermesllm/src/providers/streaming_response.rs b/crates/hermesllm/src/providers/streaming_response.rs index 66ccc735..8d06dfcf 100644 --- a/crates/hermesllm/src/providers/streaming_response.rs +++ b/crates/hermesllm/src/providers/streaming_response.rs @@ -346,12 +346,10 @@ impl TryFrom<(SseEvent, &SupportedAPIsFromClient, &SupportedUpstreamAPIs)> for S ( SupportedAPIsFromClient::OpenAIChatCompletions(_), SupportedUpstreamAPIs::AnthropicMessagesAPI(_), - ) => { + ) if transformed_event.is_event_only() && transformed_event.event.is_some() => { // OpenAI clients don't expect separate event: lines // Suppress upstream Anthropic event-only lines - if transformed_event.is_event_only() && transformed_event.event.is_some() { - transformed_event.sse_transformed_lines = "\n".to_string(); - } + transformed_event.sse_transformed_lines = "\n".to_string(); } _ => { // Other cross-API combinations can be handled here as needed @@ -371,12 +369,10 @@ impl TryFrom<(SseEvent, &SupportedAPIsFromClient, &SupportedUpstreamAPIs)> for S | ( SupportedAPIsFromClient::OpenAIResponsesAPI(_), SupportedUpstreamAPIs::OpenAIResponsesAPI(_), - ) => { - if transformed_event.is_event_only() && transformed_event.event.is_some() { - // Mark as should-skip by clearing sse_transformed_lines - // The event line is already included when the data line is transformed - transformed_event.sse_transformed_lines = String::new(); - } + ) if transformed_event.is_event_only() && transformed_event.event.is_some() => { + // Mark as should-skip by clearing sse_transformed_lines + // The event line is already included when the data line is transformed + transformed_event.sse_transformed_lines = String::new(); } _ => { // Other passthrough combinations (OpenAI ChatCompletions, etc.) don't have this issue diff --git a/crates/hermesllm/src/transforms/lib.rs b/crates/hermesllm/src/transforms/lib.rs index 115f061c..5308cc47 100644 --- a/crates/hermesllm/src/transforms/lib.rs +++ b/crates/hermesllm/src/transforms/lib.rs @@ -188,14 +188,13 @@ pub fn convert_openai_message_to_anthropic_content( // Handle regular content match &message.content { - Some(MessageContent::Text(text)) => { - if !text.is_empty() { - blocks.push(MessagesContentBlock::Text { - text: text.clone(), - cache_control: None, - }); - } + Some(MessageContent::Text(text)) if !text.is_empty() => { + blocks.push(MessagesContentBlock::Text { + text: text.clone(), + cache_control: None, + }); } + Some(MessageContent::Text(_)) => {} Some(MessageContent::Parts(parts)) => { for part in parts { match part { diff --git a/crates/hermesllm/src/transforms/request/from_anthropic.rs b/crates/hermesllm/src/transforms/request/from_anthropic.rs index 82dbe547..dba17dde 100644 --- a/crates/hermesllm/src/transforms/request/from_anthropic.rs +++ b/crates/hermesllm/src/transforms/request/from_anthropic.rs @@ -354,10 +354,10 @@ impl TryFrom for BedrockMessage { MessagesMessageContent::Blocks(blocks) => { for block in blocks { match block { - crate::apis::anthropic::MessagesContentBlock::Text { text, .. } => { - if !text.is_empty() { - content_blocks.push(ContentBlock::Text { text }); - } + crate::apis::anthropic::MessagesContentBlock::Text { text, .. } + if !text.is_empty() => + { + content_blocks.push(ContentBlock::Text { text }); } crate::apis::anthropic::MessagesContentBlock::ToolUse { id, diff --git a/crates/hermesllm/src/transforms/request/from_openai.rs b/crates/hermesllm/src/transforms/request/from_openai.rs index 70e69cb8..b673af38 100644 --- a/crates/hermesllm/src/transforms/request/from_openai.rs +++ b/crates/hermesllm/src/transforms/request/from_openai.rs @@ -317,11 +317,10 @@ impl TryFrom for BedrockMessage { Role::User => { // Convert user message content to content blocks match message.content { - Some(MessageContent::Text(text)) => { - if !text.is_empty() { - content_blocks.push(ContentBlock::Text { text }); - } + Some(MessageContent::Text(text)) if !text.is_empty() => { + content_blocks.push(ContentBlock::Text { text }); } + Some(MessageContent::Text(_)) => {} Some(MessageContent::Parts(parts)) => { // Convert OpenAI content parts to Bedrock ContentBlocks for part in parts {