clippy::let_underscore_drop

This commit is contained in:
gwenn 2022-01-05 19:26:06 +01:00 committed by Thom Chiovoloni
parent 01c4be82c8
commit 48975e015f
5 changed files with 10 additions and 10 deletions

View File

@ -473,10 +473,10 @@ impl InnerConnection {
where where
F: FnMut(), F: FnMut(),
{ {
let _ = catch_unwind(|| { drop(catch_unwind(|| {
let boxed_hook: *mut F = p_arg as *mut F; let boxed_hook: *mut F = p_arg as *mut F;
(*boxed_hook)(); (*boxed_hook)();
}); }));
} }
let free_rollback_hook = if hook.is_some() { let free_rollback_hook = if hook.is_some() {
@ -520,7 +520,7 @@ impl InnerConnection {
F: FnMut(Action, &str, &str, i64), F: FnMut(Action, &str, &str, i64),
{ {
let action = Action::from(action_code); let action = Action::from(action_code);
let _ = catch_unwind(|| { drop(catch_unwind(|| {
let boxed_hook: *mut F = p_arg as *mut F; let boxed_hook: *mut F = p_arg as *mut F;
(*boxed_hook)( (*boxed_hook)(
action, action,
@ -528,7 +528,7 @@ impl InnerConnection {
expect_utf8(p_table_name, "table name"), expect_utf8(p_table_name, "table name"),
row_id, row_id,
); );
}); }));
} }
let free_update_hook = if hook.is_some() { let free_update_hook = if hook.is_some() {

View File

@ -31,7 +31,7 @@ pub unsafe fn config_log(callback: Option<fn(c_int, &str)>) -> Result<()> {
let callback: fn(c_int, &str) = unsafe { mem::transmute(p_arg) }; let callback: fn(c_int, &str) = unsafe { mem::transmute(p_arg) };
let s = String::from_utf8_lossy(c_slice); let s = String::from_utf8_lossy(c_slice);
let _ = catch_unwind(|| callback(err, &s)); drop(catch_unwind(|| callback(err, &s)));
} }
let rc = match callback { let rc = match callback {
@ -75,7 +75,7 @@ impl Connection {
let trace_fn: fn(&str) = mem::transmute(p_arg); let trace_fn: fn(&str) = mem::transmute(p_arg);
let c_slice = CStr::from_ptr(z_sql).to_bytes(); let c_slice = CStr::from_ptr(z_sql).to_bytes();
let s = String::from_utf8_lossy(c_slice); let s = String::from_utf8_lossy(c_slice);
let _ = catch_unwind(|| trace_fn(&s)); drop(catch_unwind(|| trace_fn(&s)));
} }
let c = self.db.borrow_mut(); let c = self.db.borrow_mut();
@ -109,7 +109,7 @@ impl Connection {
nanoseconds / NANOS_PER_SEC, nanoseconds / NANOS_PER_SEC,
(nanoseconds % NANOS_PER_SEC) as u32, (nanoseconds % NANOS_PER_SEC) as u32,
); );
let _ = catch_unwind(|| profile_fn(&s, duration)); drop(catch_unwind(|| profile_fn(&s, duration)));
} }
let c = self.db.borrow_mut(); let c = self.db.borrow_mut();

View File

@ -45,7 +45,7 @@ unsafe extern "C" fn unlock_notify_cb(ap_arg: *mut *mut c_void, n_arg: c_int) {
use std::slice::from_raw_parts; use std::slice::from_raw_parts;
let args = from_raw_parts(ap_arg as *const &UnlockNotification, n_arg as usize); let args = from_raw_parts(ap_arg as *const &UnlockNotification, n_arg as usize);
for un in args { for un in args {
let _ = catch_unwind(std::panic::AssertUnwindSafe(|| un.fired())); drop(catch_unwind(std::panic::AssertUnwindSafe(|| un.fired())));
} }
} }

View File

@ -44,7 +44,7 @@ use crate::{Connection, Result};
pub(crate) const ARRAY_TYPE: *const c_char = b"rarray\0" as *const u8 as *const c_char; pub(crate) const ARRAY_TYPE: *const c_char = b"rarray\0" as *const u8 as *const c_char;
pub(crate) unsafe extern "C" fn free_array(p: *mut c_void) { pub(crate) unsafe extern "C" fn free_array(p: *mut c_void) {
let _: Array = Rc::from_raw(p as *const Vec<Value>); drop(Rc::from_raw(p as *const Vec<Value>));
} }
/// Array parameter / pointer /// Array parameter / pointer

View File

@ -919,7 +919,7 @@ where
let vt = vtab as *mut T; let vt = vtab as *mut T;
match (*vt).destroy() { match (*vt).destroy() {
Ok(_) => { Ok(_) => {
let _: Box<T> = Box::from_raw(vt); drop(Box::from_raw(vt));
ffi::SQLITE_OK ffi::SQLITE_OK
} }
Err(Error::SqliteFailure(err, s)) => { Err(Error::SqliteFailure(err, s)) => {