clippy::single_match_else

This commit is contained in:
gwenn
2022-01-05 19:59:54 +01:00
committed by Thom Chiovoloni
parent 68f41d6e9e
commit c10e2f39ef
5 changed files with 55 additions and 68 deletions

View File

@@ -34,16 +34,15 @@ pub unsafe fn config_log(callback: Option<fn(c_int, &str)>) -> Result<()> {
drop(catch_unwind(|| callback(err, &s)));
}
let rc = match callback {
Some(f) => ffi::sqlite3_config(
let rc = if let Some(f) = callback {
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)
}
)
} else {
let nullptr: *mut c_void = ptr::null_mut();
ffi::sqlite3_config(ffi::SQLITE_CONFIG_LOG, nullptr, nullptr)
};
if rc == ffi::SQLITE_OK {