diff --git a/src/session.rs b/src/session.rs index ef54f98..b4a5976 100644 --- a/src/session.rs +++ b/src/session.rs @@ -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!(), } } diff --git a/src/vtab/series.rs b/src/vtab/series.rs index a38692b..bb2a86f 100644 --- a/src/vtab/series.rs +++ b/src/vtab/series.rs @@ -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