mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Fix clippy warnings
This commit is contained in:
parent
da2d2e371a
commit
2a7b11320f
@ -60,7 +60,7 @@ impl Connection {
|
||||
let mut c = self.db.borrow_mut();
|
||||
let r = match callback {
|
||||
Some(f) => unsafe {
|
||||
ffi::sqlite3_busy_handler(c.db(), Some(busy_handler_callback), mem::transmute(f))
|
||||
ffi::sqlite3_busy_handler(c.db(), Some(busy_handler_callback), f as *mut c_void)
|
||||
},
|
||||
None => unsafe { ffi::sqlite3_busy_handler(c.db(), None, ptr::null_mut()) },
|
||||
};
|
||||
|
@ -132,7 +132,7 @@ impl InnerConnection {
|
||||
let r = unsafe {
|
||||
ffi::sqlite3_collation_needed(
|
||||
self.db(),
|
||||
mem::transmute(x_coll_needed),
|
||||
x_coll_needed as *mut c_void,
|
||||
Some(collation_needed_callback),
|
||||
)
|
||||
};
|
||||
|
17
src/trace.rs
17
src/trace.rs
@ -35,14 +35,11 @@ pub unsafe fn config_log(callback: Option<fn(c_int, &str)>) -> Result<()> {
|
||||
}
|
||||
|
||||
let rc = match callback {
|
||||
Some(f) => {
|
||||
let p_arg: *mut c_void = mem::transmute(f);
|
||||
ffi::sqlite3_config(
|
||||
ffi::SQLITE_CONFIG_LOG,
|
||||
log_callback as extern "C" fn(_, _, _),
|
||||
p_arg,
|
||||
)
|
||||
}
|
||||
Some(f) => ffi::sqlite3_config(
|
||||
ffi::SQLITE_CONFIG_LOG,
|
||||
log_callback as extern "C" fn(_, _, _),
|
||||
f as *mut c_void,
|
||||
),
|
||||
None => {
|
||||
let nullptr: *mut c_void = ptr::null_mut();
|
||||
ffi::sqlite3_config(ffi::SQLITE_CONFIG_LOG, nullptr, nullptr)
|
||||
@ -83,7 +80,7 @@ impl Connection {
|
||||
let c = self.db.borrow_mut();
|
||||
match trace_fn {
|
||||
Some(f) => unsafe {
|
||||
ffi::sqlite3_trace(c.db(), Some(trace_callback), mem::transmute(f));
|
||||
ffi::sqlite3_trace(c.db(), Some(trace_callback), f as *mut c_void);
|
||||
},
|
||||
None => unsafe {
|
||||
ffi::sqlite3_trace(c.db(), None, ptr::null_mut());
|
||||
@ -117,7 +114,7 @@ impl Connection {
|
||||
let c = self.db.borrow_mut();
|
||||
match profile_fn {
|
||||
Some(f) => unsafe {
|
||||
ffi::sqlite3_profile(c.db(), Some(profile_callback), mem::transmute(f))
|
||||
ffi::sqlite3_profile(c.db(), Some(profile_callback), f as *mut c_void)
|
||||
},
|
||||
None => unsafe { ffi::sqlite3_profile(c.db(), None, ptr::null_mut()) },
|
||||
};
|
||||
|
@ -143,10 +143,7 @@ impl FromSql for f64 {
|
||||
|
||||
impl FromSql for bool {
|
||||
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> {
|
||||
i64::column_result(value).map(|i| match i {
|
||||
0 => false,
|
||||
_ => true,
|
||||
})
|
||||
i64::column_result(value).map(|i| !matches!(i, 0))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user