Skip to content

Commit 0fbc719

Browse files
committed
clippy
1 parent 801b21c commit 0fbc719

File tree

5 files changed

+21
-24
lines changed

5 files changed

+21
-24
lines changed

src/webserver/database/execute_queries.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,10 @@ fn vars_and_name<'a, 'b>(
235235
}
236236
}
237237

238-
async fn take_connection<'a, 'b>(
238+
async fn take_connection<'a>(
239239
db: &'a Database,
240-
conn: &'b mut DbConn,
241-
) -> anyhow::Result<&'b mut PoolConnection<sqlx::Any>> {
240+
conn: &'a mut DbConn,
241+
) -> anyhow::Result<&'a mut PoolConnection<sqlx::Any>> {
242242
if let Some(c) = conn {
243243
return Ok(c);
244244
}
@@ -307,10 +307,10 @@ fn clone_anyhow_err(source_file: &Path, err: &anyhow::Error) -> anyhow::Error {
307307
e
308308
}
309309

310-
async fn bind_parameters<'a, 'b>(
310+
async fn bind_parameters<'a>(
311311
stmt: &'a StmtWithParams,
312312
request: &'a RequestInfo,
313-
db_connection: &'b mut DbConn,
313+
db_connection: &mut DbConn,
314314
) -> anyhow::Result<StatementWithParams<'a>> {
315315
let sql = stmt.query.as_str();
316316
log::debug!("Preparing statement: {}", sql);

src/webserver/database/sql.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ fn extract_toplevel_functions(stmt: &mut Statement) -> Vec<DelayedFunctionCall>
332332
.enumerate()
333333
.flat_map(|(position, item)| {
334334
let mut items = Vec::with_capacity(1);
335-
while it.peek().map_or(false, |x| x.position == position) {
335+
while it.peek().is_some_and(|x| x.position == position) {
336336
items.push(it.next().unwrap().expr_to_insert);
337337
}
338338
if items.is_empty() {

src/webserver/database/sqlpage_functions/function_definition_macro.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ macro_rules! sqlpage_functions {
5252
}
5353
}
5454
impl SqlPageFunctionName {
55-
pub(crate) async fn evaluate<'a, 'b>(
55+
pub(crate) async fn evaluate<'a>(
5656
&self,
5757
#[allow(unused_variables)]
5858
request: &'a RequestInfo,
59-
db_connection: &'b mut Option<sqlx::pool::PoolConnection<sqlx::Any>>,
59+
db_connection: &mut Option<sqlx::pool::PoolConnection<sqlx::Any>>,
6060
params: Vec<Option<Cow<'a, str>>>
6161
) -> anyhow::Result<Option<Cow<'a, str>>> {
6262
use $crate::webserver::database::sqlpage_functions::function_traits::*;

src/webserver/database/sqlpage_functions/functions.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,7 @@ async fn test_random_string() {
367367
assert_eq!(s.len(), 10);
368368
}
369369

370-
async fn read_file_bytes<'a>(
371-
request: &'a RequestInfo,
372-
path_str: &str,
373-
) -> Result<Vec<u8>, anyhow::Error> {
370+
async fn read_file_bytes(request: &RequestInfo, path_str: &str) -> Result<Vec<u8>, anyhow::Error> {
374371
let path = std::path::Path::new(path_str);
375372
// If the path is relative, it's relative to the web root, not the current working directory,
376373
// and it can be fetched from the on-database filesystem table

src/webserver/database/syntax_tree.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ impl SqlPageFunctionCall {
110110
})
111111
}
112112

113-
pub async fn evaluate<'a, 'b>(
113+
pub async fn evaluate<'a>(
114114
&self,
115115
request: &'a RequestInfo,
116-
db_connection: &'b mut DbConn,
116+
db_connection: &mut DbConn,
117117
) -> anyhow::Result<Option<Cow<'a, str>>> {
118118
let mut params = Vec::with_capacity(self.arguments.len());
119119
for param in &self.arguments {
@@ -149,10 +149,10 @@ impl std::fmt::Display for SqlPageFunctionCall {
149149

150150
/// Extracts the value of a parameter from the request.
151151
/// Returns `Ok(None)` when NULL should be used as the parameter value.
152-
pub(super) async fn extract_req_param<'a, 'b>(
152+
pub(super) async fn extract_req_param<'a>(
153153
param: &StmtParam,
154154
request: &'a RequestInfo,
155-
db_connection: &'b mut DbConn,
155+
db_connection: &mut DbConn,
156156
) -> anyhow::Result<Option<Cow<'a, str>>> {
157157
Ok(match param {
158158
// sync functions
@@ -181,10 +181,10 @@ pub(super) async fn extract_req_param<'a, 'b>(
181181
})
182182
}
183183

184-
async fn concat_params<'a, 'b>(
184+
async fn concat_params<'a>(
185185
args: &[StmtParam],
186186
request: &'a RequestInfo,
187-
db_connection: &'b mut DbConn,
187+
db_connection: &mut DbConn,
188188
) -> anyhow::Result<Option<Cow<'a, str>>> {
189189
let mut result = String::new();
190190
for arg in args {
@@ -196,10 +196,10 @@ async fn concat_params<'a, 'b>(
196196
Ok(Some(Cow::Owned(result)))
197197
}
198198

199-
async fn coalesce_params<'a, 'b>(
199+
async fn coalesce_params<'a>(
200200
args: &[StmtParam],
201201
request: &'a RequestInfo,
202-
db_connection: &'b mut DbConn,
202+
db_connection: &mut DbConn,
203203
) -> anyhow::Result<Option<Cow<'a, str>>> {
204204
for arg in args {
205205
if let Some(arg) = Box::pin(extract_req_param(arg, request, db_connection)).await? {
@@ -209,10 +209,10 @@ async fn coalesce_params<'a, 'b>(
209209
Ok(None)
210210
}
211211

212-
async fn json_object_params<'a, 'b>(
212+
async fn json_object_params<'a>(
213213
args: &[StmtParam],
214214
request: &'a RequestInfo,
215-
db_connection: &'b mut DbConn,
215+
db_connection: &mut DbConn,
216216
) -> anyhow::Result<Option<Cow<'a, str>>> {
217217
use serde::{ser::SerializeMap, Serializer};
218218
let mut result = Vec::new();
@@ -247,10 +247,10 @@ async fn json_object_params<'a, 'b>(
247247
Ok(Some(Cow::Owned(String::from_utf8(result)?)))
248248
}
249249

250-
async fn json_array_params<'a, 'b>(
250+
async fn json_array_params<'a>(
251251
args: &[StmtParam],
252252
request: &'a RequestInfo,
253-
db_connection: &'b mut DbConn,
253+
db_connection: &mut DbConn,
254254
) -> anyhow::Result<Option<Cow<'a, str>>> {
255255
use serde::{ser::SerializeSeq, Serializer};
256256
let mut result = Vec::new();

0 commit comments

Comments
 (0)