Fix clippy warning unnecessary_cast

This commit is contained in:
gwenn 2023-10-11 19:01:31 +02:00
parent 845761e498
commit 94bba92ba0

View File

@ -638,6 +638,7 @@ unsafe extern "C" fn call_boxed_step<A, D, T>(
args: slice::from_raw_parts(argv, argc as usize), args: slice::from_raw_parts(argv, argc as usize),
}; };
#[allow(clippy::unnecessary_cast)]
if (*pac as *mut A).is_null() { if (*pac as *mut A).is_null() {
*pac = Box::into_raw(Box::new((*boxed_aggr).init(&mut ctx)?)); *pac = Box::into_raw(Box::new((*boxed_aggr).init(&mut ctx)?));
} }
@ -708,7 +709,9 @@ where
// Within the xFinal callback, it is customary to set N=0 in calls to // Within the xFinal callback, it is customary to set N=0 in calls to
// sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur. // sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur.
let a: Option<A> = match aggregate_context(ctx, 0) { let a: Option<A> = match aggregate_context(ctx, 0) {
Some(pac) => { Some(pac) =>
{
#[allow(clippy::unnecessary_cast)]
if (*pac as *mut A).is_null() { if (*pac as *mut A).is_null() {
None None
} else { } else {
@ -753,7 +756,9 @@ where
// Within the xValue callback, it is customary to set N=0 in calls to // Within the xValue callback, it is customary to set N=0 in calls to
// sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur. // sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur.
let a: Option<&A> = match aggregate_context(ctx, 0) { let a: Option<&A> = match aggregate_context(ctx, 0) {
Some(pac) => { Some(pac) =>
{
#[allow(clippy::unnecessary_cast)]
if (*pac as *mut A).is_null() { if (*pac as *mut A).is_null() {
None None
} else { } else {