Skip to content

Commit 447fa52

Browse files
committed
cargo clippy fixes
1 parent 50ad45e commit 447fa52

File tree

7 files changed

+18
-24
lines changed

7 files changed

+18
-24
lines changed

async-openai/src/types/chat/chat.rs renamed to async-openai/src/types/chat/chat_types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,6 @@ pub struct ChatCompletionDeleted {
13461346
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
13471347
#[serde(tag = "type")]
13481348
#[serde(rename_all = "snake_case")]
1349-
13501349
pub enum ContentPart {
13511350
Text(ChatCompletionRequestMessageContentPartText),
13521351
ImageUrl(ChatCompletionRequestMessageContentPartImage),

async-openai/src/types/chat/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
mod chat;
1+
mod chat_types;
22

3-
pub use chat::*;
3+
pub use chat_types::*;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
mod containers;
1+
mod container;
22

3-
pub use containers::*;
3+
pub use container::*;

async-openai/src/types/finetuning/fine_tuning.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ pub enum FineTuneMethod {
146146
dpo: FineTuneDPOMethod,
147147
},
148148
Reinforcement {
149-
reinforcement: FineTuneReinforcementMethod,
149+
// Boxed because https://rust-lang.github.io/rust-clippy/rust-1.91.0/index.html#large_enum_variant
150+
reinforcement: Box<FineTuneReinforcementMethod>,
150151
},
151152
}
152153

async-openai/src/types/impls.rs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ use crate::{
2626
ChatCompletionRequestSystemMessageContent, ChatCompletionRequestToolMessage,
2727
ChatCompletionRequestToolMessageContent, ChatCompletionRequestUserMessage,
2828
ChatCompletionRequestUserMessageContent, ChatCompletionRequestUserMessageContentPart,
29-
ChatCompletionToolChoiceOption, FunctionName, ImageUrl, Prompt, Role,
30-
StopConfiguration,
29+
FunctionName, ImageUrl, Prompt, Role, StopConfiguration,
3130
},
3231
containers::CreateContainerFileRequest,
3332
embeddings::EmbeddingInput,
@@ -38,7 +37,7 @@ use crate::{
3837
},
3938
images::{ImageBackground, ImageEditInput, ImageOutputFormat, ImageQuality, InputFidelity},
4039
moderations::ModerationInput,
41-
responses::{EasyInputContent, Role as ResponsesRole},
40+
responses::EasyInputContent,
4241
uploads::AddUploadPartRequest,
4342
videos::{CreateVideoRequest, VideoSize},
4443
CreateMessageRequestContent, InputSource,
@@ -223,50 +222,50 @@ impl From<PathBuf> for ImageEditInput {
223222
// Arrays of path-like values
224223
impl<const N: usize> From<[&str; N]> for ImageEditInput {
225224
fn from(value: [&str; N]) -> Self {
226-
Self::Images(value.into_iter().map(|v| ImageInput::from(v)).collect())
225+
Self::Images(value.into_iter().map(ImageInput::from).collect())
227226
}
228227
}
229228

230229
impl<const N: usize> From<[String; N]> for ImageEditInput {
231230
fn from(value: [String; N]) -> Self {
232-
Self::Images(value.into_iter().map(|v| ImageInput::from(v)).collect())
231+
Self::Images(value.into_iter().map(ImageInput::from).collect())
233232
}
234233
}
235234

236235
impl<const N: usize> From<[&Path; N]> for ImageEditInput {
237236
fn from(value: [&Path; N]) -> Self {
238-
Self::Images(value.into_iter().map(|v| ImageInput::from(v)).collect())
237+
Self::Images(value.into_iter().map(ImageInput::from).collect())
239238
}
240239
}
241240

242241
impl<const N: usize> From<[PathBuf; N]> for ImageEditInput {
243242
fn from(value: [PathBuf; N]) -> Self {
244-
Self::Images(value.into_iter().map(|v| ImageInput::from(v)).collect())
243+
Self::Images(value.into_iter().map(ImageInput::from).collect())
245244
}
246245
}
247246

248247
// Vectors of path-like values
249248
impl<'a> From<Vec<&'a str>> for ImageEditInput {
250249
fn from(value: Vec<&'a str>) -> Self {
251-
Self::Images(value.into_iter().map(|v| ImageInput::from(v)).collect())
250+
Self::Images(value.into_iter().map(ImageInput::from).collect())
252251
}
253252
}
254253

255254
impl From<Vec<String>> for ImageEditInput {
256255
fn from(value: Vec<String>) -> Self {
257-
Self::Images(value.into_iter().map(|v| ImageInput::from(v)).collect())
256+
Self::Images(value.into_iter().map(ImageInput::from).collect())
258257
}
259258
}
260259

261260
impl From<Vec<&Path>> for ImageEditInput {
262261
fn from(value: Vec<&Path>) -> Self {
263-
Self::Images(value.into_iter().map(|v| ImageInput::from(v)).collect())
262+
Self::Images(value.into_iter().map(ImageInput::from).collect())
264263
}
265264
}
266265

267266
impl From<Vec<PathBuf>> for ImageEditInput {
268267
fn from(value: Vec<PathBuf>) -> Self {
269-
Self::Images(value.into_iter().map(|v| ImageInput::from(v)).collect())
268+
Self::Images(value.into_iter().map(ImageInput::from).collect())
270269
}
271270
}
272271

@@ -1327,12 +1326,6 @@ impl Default for EasyInputContent {
13271326
}
13281327
}
13291328

1330-
impl Default for ResponsesRole {
1331-
fn default() -> Self {
1332-
Self::User
1333-
}
1334-
}
1335-
13361329
impl From<String> for EasyInputContent {
13371330
fn from(value: String) -> Self {
13381331
Self::Text(value)

async-openai/src/types/responses/response.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ use serde::{Deserialize, Serialize};
99
use std::collections::HashMap;
1010

1111
/// Role of messages in the API.
12-
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
12+
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Default)]
1313
#[serde(rename_all = "lowercase")]
1414
pub enum Role {
15+
#[default]
1516
User,
1617
Assistant,
1718
System,

0 commit comments

Comments
 (0)