Skip to content

Commit 8686a0c

Browse files
committed
chore: fix clippy suggestions
1 parent 348323d commit 8686a0c

File tree

10 files changed

+14
-17
lines changed

10 files changed

+14
-17
lines changed

llm/anthropic/src/conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub fn process_response(response: MessagesResponse) -> ChatEvent {
130130
Err(e) => {
131131
return ChatEvent::Error(Error {
132132
code: ErrorCode::InvalidRequest,
133-
message: format!("Failed to decode base64 image data: {}", e),
133+
message: format!("Failed to decode base64 image data: {e}"),
134134
provider_error_json: None,
135135
});
136136
}

llm/bedrock/src/async_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ impl AsyncRuntime {
1111
where
1212
F: Future,
1313
{
14-
wasi_async_runtime::block_on(|_| async { f.await })
14+
wasi_async_runtime::block_on(|_| f)
1515
}
1616
}

llm/bedrock/src/conversions.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,7 @@ fn get_image_content_block_from_url(url: &str) -> Result<bedrock::types::Content
210210
None => {
211211
return Err(custom_error(
212212
llm::ErrorCode::InvalidRequest,
213-
format!(
214-
"Could not infer the mime type of the image downloaded from url: {}",
215-
url
216-
),
213+
format!("Could not infer the mime type of the image downloaded from url: {url}"),
217214
));
218215
}
219216
};
@@ -266,7 +263,7 @@ fn str_to_bedrock_mime_type(mime_type: &str) -> Result<ImageFormat, llm::Error>
266263
"image/gif" => Ok(ImageFormat::Gif),
267264
other => Err(llm::Error {
268265
code: llm::ErrorCode::Unsupported,
269-
message: format!("Unsupported image type: {}", other),
266+
message: format!("Unsupported image type: {other}"),
270267
provider_error_json: None,
271268
}),
272269
}
@@ -503,7 +500,7 @@ fn process_message_stop_event(event: MessageStopEvent) -> Option<llm::StreamEven
503500
fn json_str_to_smithy_document(value: &str) -> Result<Document, llm::Error> {
504501
let json_value: serde_json::Value = serde_json::from_str(value).map_err(|err| llm::Error {
505502
code: llm::ErrorCode::InvalidRequest,
506-
message: format!("Invalid tool schema: {}", err),
503+
message: format!("Invalid tool schema: {err}"),
507504
provider_error_json: None,
508505
})?;
509506
Ok(serde_json_to_smithy_document(json_value))

llm/grok/src/conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ fn convert_content_parts(contents: Vec<ContentPart>) -> crate::client::Content {
183183
let media_type = &image_source.mime_type; // This is already a string
184184
result.push(crate::client::ContentPart::ImageInput {
185185
image_url: crate::client::ImageUrl {
186-
url: format!("data:{};base64,{}", media_type, base64_data),
186+
url: format!("data:{media_type};base64,{base64_data}"),
187187
detail: image_source.detail.map(|d| d.into()),
188188
},
189189
});

llm/llm/src/event_source/ndjson_stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn try_parse_line(
126126
return Ok(None);
127127
}
128128

129-
trace!("Parsed NDJSON line: {}", line);
129+
trace!("Parsed NDJSON line: {line}");
130130

131131
// Create a MessageEvent with the JSON line as data
132132
let event = MessageEvent {

llm/llm/src/event_source/stream.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ where
5656
{
5757
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5858
match self {
59-
Self::Utf8(err) => f.write_fmt(format_args!("UTF8 error: {}", err)),
60-
Self::Parser(err) => f.write_fmt(format_args!("Parse error: {}", err)),
61-
Self::Transport(err) => f.write_fmt(format_args!("Transport error: {}", err)),
59+
Self::Utf8(err) => f.write_fmt(format_args!("UTF8 error: {err}")),
60+
Self::Parser(err) => f.write_fmt(format_args!("Parse error: {err}")),
61+
Self::Transport(err) => f.write_fmt(format_args!("Transport error: {err}")),
6262
}
6363
}
6464
}

llm/ollama/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ pub fn image_to_base64(source: &str) -> Result<String, Box<dyn std::error::Error
335335
pub fn from_reqwest_error(context: &str, err: reqwest::Error) -> Error {
336336
Error {
337337
code: ErrorCode::InternalError,
338-
message: format!("{}: {}", context, err),
338+
message: format!("{context}: {err}"),
339339
provider_error_json: None,
340340
}
341341
}

llm/ollama/src/conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub fn process_response(response: CompletionsResponse) -> ChatEvent {
214214
};
215215

216216
ChatEvent::Message(CompleteResponse {
217-
id: format!("ollama-{}", timestamp),
217+
id: format!("ollama-{timestamp}"),
218218
content,
219219
tool_calls,
220220
metadata,

llm/openai/src/conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ pub fn content_part_to_inner_input_item(content_part: ContentPart) -> InnerInput
138138
ImageReference::Inline(image_source) => {
139139
let base64_data = general_purpose::STANDARD.encode(&image_source.data);
140140
let mime_type = &image_source.mime_type; // This is already a string
141-
let data_url = format!("data:{};base64,{}", mime_type, base64_data);
141+
let data_url = format!("data:{mime_type};base64,{base64_data}");
142142

143143
InnerInputItem::ImageInput {
144144
image_url: data_url,

llm/openrouter/src/conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ fn convert_content_parts(contents: Vec<ContentPart>) -> crate::client::Content {
184184
let media_type = &image_source.mime_type; // This is already a string
185185
result.push(crate::client::ContentPart::ImageInput {
186186
image_url: crate::client::ImageUrl {
187-
url: format!("data:{};base64,{}", media_type, base64_data),
187+
url: format!("data:{media_type};base64,{base64_data}"),
188188
detail: image_source.detail.map(|d| d.into()),
189189
},
190190
});

0 commit comments

Comments
 (0)