Merge pull request #1249 from gwenn/clippy

Fix clippy warnings
This commit is contained in:
gwenn 2022-11-09 20:08:05 +01:00 committed by GitHub
commit cc2c2908ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 16 deletions

View File

@ -75,13 +75,10 @@ impl Session<'_> {
let c_slice = CStr::from_ptr(tbl_str).to_bytes();
str::from_utf8(c_slice)
};
if let Ok(true) =
c_int::from(
catch_unwind(|| (*boxed_filter)(tbl_name.expect("non-utf8 table name")))
{
1
} else {
0
}
.unwrap_or_default(),
)
}
match filter {
@ -193,7 +190,7 @@ impl Session<'_> {
#[inline]
pub fn set_enabled(&mut self, enabled: bool) {
unsafe {
ffi::sqlite3session_enable(self.s, if enabled { 1 } else { 0 });
ffi::sqlite3session_enable(self.s, c_int::from(enabled));
}
}
@ -207,7 +204,7 @@ impl Session<'_> {
#[inline]
pub fn set_indirect(&mut self, indirect: bool) {
unsafe {
ffi::sqlite3session_indirect(self.s, if indirect { 1 } else { 0 });
ffi::sqlite3session_indirect(self.s, c_int::from(indirect));
}
}
}
@ -708,13 +705,9 @@ where
str::from_utf8(c_slice)
};
match *tuple {
(Some(ref filter), _) => {
if let Ok(true) = catch_unwind(|| filter(tbl_name.expect("illegal table name"))) {
1
} else {
0
}
}
(Some(ref filter), _) => c_int::from(
catch_unwind(|| filter(tbl_name.expect("illegal table name"))).unwrap_or_default(),
),
_ => unimplemented!(),
}
}

View File

@ -115,7 +115,7 @@ unsafe impl<'vtab> VTab<'vtab> for SeriesTab {
}
if idx_num.contains(QueryPlanFlags::BOTH) {
// Both start= and stop= boundaries are available.
//#[allow(clippy::bool_to_int_with_if)]
#[allow(clippy::bool_to_int_with_if)]
info.set_estimated_cost(f64::from(
2 - if idx_num.contains(QueryPlanFlags::STEP) {
1