Skip to content

Commit 6becdfc

Browse files
authored
style: add explicit lifetime parameter to methods (#450)
with changes to rust lifetime elision rules, the compiler generates a warning for methods that return a type that has a lifetime parameter tied to &self but are not explicit about it
1 parent 61ab980 commit 6becdfc

File tree

6 files changed

+28
-29
lines changed

6 files changed

+28
-29
lines changed

async-openai/src/client.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,102 +73,102 @@ impl<C: Config> Client<C> {
7373
// API groups
7474

7575
/// To call [Models] group related APIs using this client.
76-
pub fn models(&self) -> Models<C> {
76+
pub fn models(&self) -> Models<'_, C> {
7777
Models::new(self)
7878
}
7979

8080
/// To call [Completions] group related APIs using this client.
81-
pub fn completions(&self) -> Completions<C> {
81+
pub fn completions(&self) -> Completions<'_, C> {
8282
Completions::new(self)
8383
}
8484

8585
/// To call [Chat] group related APIs using this client.
86-
pub fn chat(&self) -> Chat<C> {
86+
pub fn chat(&self) -> Chat<'_, C> {
8787
Chat::new(self)
8888
}
8989

9090
/// To call [Images] group related APIs using this client.
91-
pub fn images(&self) -> Images<C> {
91+
pub fn images(&self) -> Images<'_, C> {
9292
Images::new(self)
9393
}
9494

9595
/// To call [Moderations] group related APIs using this client.
96-
pub fn moderations(&self) -> Moderations<C> {
96+
pub fn moderations(&self) -> Moderations<'_, C> {
9797
Moderations::new(self)
9898
}
9999

100100
/// To call [Files] group related APIs using this client.
101-
pub fn files(&self) -> Files<C> {
101+
pub fn files(&self) -> Files<'_, C> {
102102
Files::new(self)
103103
}
104104

105105
/// To call [Uploads] group related APIs using this client.
106-
pub fn uploads(&self) -> Uploads<C> {
106+
pub fn uploads(&self) -> Uploads<'_, C> {
107107
Uploads::new(self)
108108
}
109109

110110
/// To call [FineTuning] group related APIs using this client.
111-
pub fn fine_tuning(&self) -> FineTuning<C> {
111+
pub fn fine_tuning(&self) -> FineTuning<'_, C> {
112112
FineTuning::new(self)
113113
}
114114

115115
/// To call [Embeddings] group related APIs using this client.
116-
pub fn embeddings(&self) -> Embeddings<C> {
116+
pub fn embeddings(&self) -> Embeddings<'_, C> {
117117
Embeddings::new(self)
118118
}
119119

120120
/// To call [Audio] group related APIs using this client.
121-
pub fn audio(&self) -> Audio<C> {
121+
pub fn audio(&self) -> Audio<'_, C> {
122122
Audio::new(self)
123123
}
124124

125125
/// To call [Videos] group related APIs using this client.
126-
pub fn videos(&self) -> Videos<C> {
126+
pub fn videos(&self) -> Videos<'_, C> {
127127
Videos::new(self)
128128
}
129129

130130
/// To call [Assistants] group related APIs using this client.
131-
pub fn assistants(&self) -> Assistants<C> {
131+
pub fn assistants(&self) -> Assistants<'_, C> {
132132
Assistants::new(self)
133133
}
134134

135135
/// To call [Threads] group related APIs using this client.
136-
pub fn threads(&self) -> Threads<C> {
136+
pub fn threads(&self) -> Threads<'_, C> {
137137
Threads::new(self)
138138
}
139139

140140
/// To call [VectorStores] group related APIs using this client.
141-
pub fn vector_stores(&self) -> VectorStores<C> {
141+
pub fn vector_stores(&self) -> VectorStores<'_, C> {
142142
VectorStores::new(self)
143143
}
144144

145145
/// To call [Batches] group related APIs using this client.
146-
pub fn batches(&self) -> Batches<C> {
146+
pub fn batches(&self) -> Batches<'_, C> {
147147
Batches::new(self)
148148
}
149149

150150
/// To call [AuditLogs] group related APIs using this client.
151-
pub fn audit_logs(&self) -> AuditLogs<C> {
151+
pub fn audit_logs(&self) -> AuditLogs<'_, C> {
152152
AuditLogs::new(self)
153153
}
154154

155155
/// To call [Invites] group related APIs using this client.
156-
pub fn invites(&self) -> Invites<C> {
156+
pub fn invites(&self) -> Invites<'_, C> {
157157
Invites::new(self)
158158
}
159159

160160
/// To call [Users] group related APIs using this client.
161-
pub fn users(&self) -> Users<C> {
161+
pub fn users(&self) -> Users<'_, C> {
162162
Users::new(self)
163163
}
164164

165165
/// To call [Projects] group related APIs using this client.
166-
pub fn projects(&self) -> Projects<C> {
166+
pub fn projects(&self) -> Projects<'_, C> {
167167
Projects::new(self)
168168
}
169169

170170
/// To call [Responses] group related APIs using this client.
171-
pub fn responses(&self) -> Responses<C> {
171+
pub fn responses(&self) -> Responses<'_, C> {
172172
Responses::new(self)
173173
}
174174

async-openai/src/embedding.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ impl<'c, C: Config> Embeddings<'c, C> {
6464

6565
#[cfg(test)]
6666
mod tests {
67-
use crate::error::OpenAIError;
6867
use crate::types::{CreateEmbeddingResponse, Embedding, EncodingFormat};
6968
use crate::{types::CreateEmbeddingRequestArgs, Client};
7069

async-openai/src/projects.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ impl<'c, C: Config> Projects<'c, C> {
2020
}
2121

2222
// call [ProjectUsers] group APIs
23-
pub fn users(&self, project_id: &str) -> ProjectUsers<C> {
23+
pub fn users(&self, project_id: &str) -> ProjectUsers<'_, C> {
2424
ProjectUsers::new(self.client, project_id)
2525
}
2626

2727
// call [ProjectServiceAccounts] group APIs
28-
pub fn service_accounts(&self, project_id: &str) -> ProjectServiceAccounts<C> {
28+
pub fn service_accounts(&self, project_id: &str) -> ProjectServiceAccounts<'_, C> {
2929
ProjectServiceAccounts::new(self.client, project_id)
3030
}
3131

3232
// call [ProjectAPIKeys] group APIs
33-
pub fn api_keys(&self, project_id: &str) -> ProjectAPIKeys<C> {
33+
pub fn api_keys(&self, project_id: &str) -> ProjectAPIKeys<'_, C> {
3434
ProjectAPIKeys::new(self.client, project_id)
3535
}
3636

async-openai/src/runs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<'c, C: Config> Runs<'c, C> {
2828
}
2929

3030
/// [Steps] API group
31-
pub fn steps(&self, run_id: &str) -> Steps<C> {
31+
pub fn steps(&self, run_id: &str) -> Steps<'_, C> {
3232
Steps::new(self.client, &self.thread_id, run_id)
3333
}
3434

async-openai/src/threads.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ impl<'c, C: Config> Threads<'c, C> {
2121
}
2222

2323
/// Call [Messages] group API to manage message in [thread_id] thread.
24-
pub fn messages(&self, thread_id: &str) -> Messages<C> {
24+
pub fn messages(&self, thread_id: &str) -> Messages<'_, C> {
2525
Messages::new(self.client, thread_id)
2626
}
2727

2828
/// Call [Runs] group API to manage runs in [thread_id] thread.
29-
pub fn runs(&self, thread_id: &str) -> Runs<C> {
29+
pub fn runs(&self, thread_id: &str) -> Runs<'_, C> {
3030
Runs::new(self.client, thread_id)
3131
}
3232

async-openai/src/vector_stores.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ impl<'c, C: Config> VectorStores<'c, C> {
2222
}
2323

2424
/// [VectorStoreFiles] API group
25-
pub fn files(&self, vector_store_id: &str) -> VectorStoreFiles<C> {
25+
pub fn files(&self, vector_store_id: &str) -> VectorStoreFiles<'_, C> {
2626
VectorStoreFiles::new(self.client, vector_store_id)
2727
}
2828

2929
/// [VectorStoreFileBatches] API group
30-
pub fn file_batches(&self, vector_store_id: &str) -> VectorStoreFileBatches<C> {
30+
pub fn file_batches(&self, vector_store_id: &str) -> VectorStoreFileBatches<'_, C> {
3131
VectorStoreFileBatches::new(self.client, vector_store_id)
3232
}
3333

0 commit comments

Comments
 (0)