Skip to content

Commit ff5ae88

Browse files
committed
cargo clippy
1 parent 872cf00 commit ff5ae88

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/dbc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ impl Database {
4141
) -> Result<QueryResult, Error> {
4242
let mut query = query.to_string();
4343
for param in params {
44-
let quoted_param = if let Some(_) = param.strip_prefix('\'') {
44+
let quoted_param = if param.strip_prefix('\'').is_some() {
4545
// If the parameter already has single quotes, don't add them again.
4646
// This avoids SQL injection vulnerabilities when the parameter contains a quote.
4747
param.to_string()
4848
} else {
4949
// If the parameter doesn't have single quotes, add them.
5050
format!("'{}'", param)
5151
};
52-
query = query.replacen("?", quoted_param.as_str(), 1);
52+
query = query.replacen('?', quoted_param.as_str(), 1);
5353
}
5454
self.execute_query(&query)
5555
}

src/dbc/sqlite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl dbc::Connection for SQLiteConnection {
6161
}
6262
Ok(dbc::QueryResult {
6363
rows,
64-
affected_rows: 0 as usize,
64+
affected_rows: 0_usize,
6565
})
6666
}
6767
}

tests/mysql_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ fn _prepare_mysql_database() -> Result<dbc::Database, Error> {
3131
#[serial_test::serial]
3232
async fn test_mysql_simple_query() -> Result<(), Error> {
3333
let database = _prepare_mysql_database()?;
34-
Ok(common::test_simple_query(database).await?)
34+
common::test_simple_query(database).await
3535
}
3636

3737
#[tokio::test]
3838
#[serial_test::serial]
3939
async fn test_mysql_query_with_params() -> Result<(), Error> {
4040
let database = _prepare_mysql_database()?;
41-
Ok(common::test_query_with_params(database).await?)
41+
common::test_query_with_params(database).await
4242
}
4343

4444
#[tokio::test]
4545
#[serial_test::serial]
4646
async fn test_mysql_query_with_params_and_serialize() -> Result<(), Error> {
4747
let database = _prepare_mysql_database()?;
48-
Ok(common::test_query_with_params_and_serialize(database).await?)
48+
common::test_query_with_params_and_serialize(database).await
4949
}

tests/sqlite_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ fn _prepare_sqlite_database() -> Result<dbc::Database, Error> {
2323
#[serial_test::serial]
2424
async fn test_sqlite_simple_query() -> Result<(), Error> {
2525
let database = _prepare_sqlite_database()?;
26-
Ok(common::test_simple_query(database).await?)
26+
common::test_simple_query(database).await
2727
}
2828

2929
#[tokio::test]
3030
#[serial_test::serial]
3131
async fn test_sqlite_query_with_params() -> Result<(), Error> {
3232
let database = _prepare_sqlite_database()?;
33-
Ok(common::test_query_with_params(database).await?)
33+
common::test_query_with_params(database).await
3434
}
3535

3636
#[tokio::test]
3737
#[serial_test::serial]
3838
async fn test_sqlite_query_with_params_and_serialize() -> Result<(), Error> {
3939
let database = _prepare_sqlite_database()?;
40-
Ok(common::test_query_with_params_and_serialize(database).await?)
40+
common::test_query_with_params_and_serialize(database).await
4141
}

0 commit comments

Comments
 (0)