fix: silence collapsible_match clippy lint (rustc 1.95)

Made-with: Cursor
This commit is contained in:
Syed Hashmi 2026-04-21 13:29:55 -07:00
parent a04571afbc
commit cb2fdc9dbf
No known key found for this signature in database
5 changed files with 21 additions and 29 deletions

View file

@ -441,11 +441,9 @@ impl ArchFunctionHandler {
} }
} }
// Handle str/string conversions // Handle str/string conversions
"str" | "string" => { "str" | "string" if !value.is_string() => {
if !value.is_string() {
return Ok(json!(value.to_string())); return Ok(json!(value.to_string()));
} }
}
_ => {} _ => {}
} }
Ok(value.clone()) Ok(value.clone())

View file

@ -346,13 +346,11 @@ impl TryFrom<(SseEvent, &SupportedAPIsFromClient, &SupportedUpstreamAPIs)> for S
( (
SupportedAPIsFromClient::OpenAIChatCompletions(_), SupportedAPIsFromClient::OpenAIChatCompletions(_),
SupportedUpstreamAPIs::AnthropicMessagesAPI(_), SupportedUpstreamAPIs::AnthropicMessagesAPI(_),
) => { ) if transformed_event.is_event_only() && transformed_event.event.is_some() => {
// OpenAI clients don't expect separate event: lines // OpenAI clients don't expect separate event: lines
// Suppress upstream Anthropic event-only 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 // Other cross-API combinations can be handled here as needed
} }
@ -371,13 +369,11 @@ impl TryFrom<(SseEvent, &SupportedAPIsFromClient, &SupportedUpstreamAPIs)> for S
| ( | (
SupportedAPIsFromClient::OpenAIResponsesAPI(_), SupportedAPIsFromClient::OpenAIResponsesAPI(_),
SupportedUpstreamAPIs::OpenAIResponsesAPI(_), SupportedUpstreamAPIs::OpenAIResponsesAPI(_),
) => { ) if transformed_event.is_event_only() && transformed_event.event.is_some() => {
if transformed_event.is_event_only() && transformed_event.event.is_some() {
// Mark as should-skip by clearing sse_transformed_lines // Mark as should-skip by clearing sse_transformed_lines
// The event line is already included when the data line is transformed // The event line is already included when the data line is transformed
transformed_event.sse_transformed_lines = String::new(); transformed_event.sse_transformed_lines = String::new();
} }
}
_ => { _ => {
// Other passthrough combinations (OpenAI ChatCompletions, etc.) don't have this issue // Other passthrough combinations (OpenAI ChatCompletions, etc.) don't have this issue
} }

View file

@ -188,14 +188,13 @@ pub fn convert_openai_message_to_anthropic_content(
// Handle regular content // Handle regular content
match &message.content { match &message.content {
Some(MessageContent::Text(text)) => { Some(MessageContent::Text(text)) if !text.is_empty() => {
if !text.is_empty() {
blocks.push(MessagesContentBlock::Text { blocks.push(MessagesContentBlock::Text {
text: text.clone(), text: text.clone(),
cache_control: None, cache_control: None,
}); });
} }
} Some(MessageContent::Text(_)) => {}
Some(MessageContent::Parts(parts)) => { Some(MessageContent::Parts(parts)) => {
for part in parts { for part in parts {
match part { match part {

View file

@ -354,11 +354,11 @@ impl TryFrom<MessagesMessage> for BedrockMessage {
MessagesMessageContent::Blocks(blocks) => { MessagesMessageContent::Blocks(blocks) => {
for block in blocks { for block in blocks {
match block { match block {
crate::apis::anthropic::MessagesContentBlock::Text { text, .. } => { crate::apis::anthropic::MessagesContentBlock::Text { text, .. }
if !text.is_empty() { if !text.is_empty() =>
{
content_blocks.push(ContentBlock::Text { text }); content_blocks.push(ContentBlock::Text { text });
} }
}
crate::apis::anthropic::MessagesContentBlock::ToolUse { crate::apis::anthropic::MessagesContentBlock::ToolUse {
id, id,
name, name,

View file

@ -317,11 +317,10 @@ impl TryFrom<Message> for BedrockMessage {
Role::User => { Role::User => {
// Convert user message content to content blocks // Convert user message content to content blocks
match message.content { match message.content {
Some(MessageContent::Text(text)) => { Some(MessageContent::Text(text)) if !text.is_empty() => {
if !text.is_empty() {
content_blocks.push(ContentBlock::Text { text }); content_blocks.push(ContentBlock::Text { text });
} }
} Some(MessageContent::Text(_)) => {}
Some(MessageContent::Parts(parts)) => { Some(MessageContent::Parts(parts)) => {
// Convert OpenAI content parts to Bedrock ContentBlocks // Convert OpenAI content parts to Bedrock ContentBlocks
for part in parts { for part in parts {