Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
kumavale committed Dec 31, 2024
1 parent e2f5587 commit eac4620
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions concatsql/src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ from_sql_impl! {
std::num::NonZeroI16,
std::num::NonZeroI32,
std::num::NonZeroI64,
std::num::NonZeroI128,
std::num::NonZeroIsize,
std::num::NonZeroU8,
std::num::NonZeroU16,
Expand All @@ -250,9 +251,6 @@ from_sql_impl! {
String,
}

#[cfg(feature = "uuid")]
from_sql_impl! { std::num::NonZeroI128 }

impl FromSql for Vec<u8> {
#[doc(hidden)]
fn from_sql(s: &str) -> Result<Self, Error> {
Expand Down Expand Up @@ -284,7 +282,7 @@ mod tests {
}

#[test]
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrow, clippy::needless_borrows_for_generic_args)]
fn row() {
let mut row = Row::new(["key1","key2","key3","ABC"].iter().map(ToString::to_string).collect());
row.insert("key1", Some("value".to_string()));
Expand Down Expand Up @@ -353,9 +351,11 @@ mod tests {

assert!(!row.is_empty());

assert_eq!(row.get("key1"), Some("value"));
assert_eq!(row.get(&"key1"), Some("value"));
assert_eq!(row.get(&&&&&&&&"key1"), Some("value"));
assert_eq!(row.get(&*String::from("key1")), Some("value"));
assert_eq!(row.get(0), Some("value"));
assert_eq!(row.get(&0), Some("value"));
assert_eq!(row.get(String::from("key1")), Some("value"));
assert_eq!(row.get(&String::from("key1")), Some("value"));
Expand Down
8 changes: 4 additions & 4 deletions concatsql/src/sqlite/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ unsafe fn bind_all(stmt: *mut ffi::sqlite3_stmt, params: &[Value<'_>], error_lev
index,
value.as_ptr() as *const _,
value.len() as i32,
Some(std::mem::transmute(ffi::SQLITE_TRANSIENT as *const c_void)),
Some(std::mem::transmute::<*const c_void, extern "C" fn(*mut c_void)>(ffi::SQLITE_TRANSIENT as *const c_void)),
)
}
Value::Bytes(value) => {
Expand All @@ -327,7 +327,7 @@ unsafe fn bind_all(stmt: *mut ffi::sqlite3_stmt, params: &[Value<'_>], error_lev
index,
value.as_ptr() as *const _,
value.len() as i32,
Some(std::mem::transmute(ffi::SQLITE_TRANSIENT as *const c_void)),
Some(std::mem::transmute::<*const c_void, extern "C" fn(*mut c_void)>(ffi::SQLITE_TRANSIENT as *const c_void)),
)
}
Value::IpAddr(value) => {
Expand All @@ -337,7 +337,7 @@ unsafe fn bind_all(stmt: *mut ffi::sqlite3_stmt, params: &[Value<'_>], error_lev
index,
value.as_ptr() as *const _,
value.len() as i32,
Some(std::mem::transmute(ffi::SQLITE_TRANSIENT as *const c_void)),
Some(std::mem::transmute::<*const c_void, extern "C" fn(*mut c_void)>(ffi::SQLITE_TRANSIENT as *const c_void)),
)
}
Value::Time(value) => {
Expand All @@ -347,7 +347,7 @@ unsafe fn bind_all(stmt: *mut ffi::sqlite3_stmt, params: &[Value<'_>], error_lev
index,
value.as_ptr() as *const _,
value.len() as i32,
Some(std::mem::transmute(ffi::SQLITE_TRANSIENT as *const c_void)),
Some(std::mem::transmute::<*const c_void, extern "C" fn(*mut c_void)>(ffi::SQLITE_TRANSIENT as *const c_void)),
)
}
};
Expand Down
2 changes: 2 additions & 0 deletions concatsql/tests/mysql.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::never_loop)]

#[cfg(feature = "mysql")]
#[cfg(debug_assertions)]
mod mysql {
Expand Down
2 changes: 2 additions & 0 deletions concatsql/tests/postgres.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::never_loop)]

#[cfg(feature = "postgres")]
#[cfg(debug_assertions)]
mod postgres {
Expand Down
2 changes: 2 additions & 0 deletions concatsql/tests/sqlite.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::never_loop)]

#[cfg(feature = "sqlite")]
#[cfg(debug_assertions)]
Expand Down Expand Up @@ -628,6 +629,7 @@ mod anti_patterns {
}

let sql = prep!("SELECT age FROM users WHERE name < ") + u32::MIN;
#[allow(clippy::never_loop)]
for _ in conn.rows(&sql).unwrap() {
unreachable!();
}
Expand Down

0 comments on commit eac4620

Please sign in to comment.