Merge pull request #1400 from gwenn/arc_with_non_send_sync

Fix clippy warning: arc_with_non_send_sync - interrupt_lock
This commit is contained in:
gwenn 2023-10-11 20:07:26 +02:00 committed by GitHub
commit e505e1bca8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

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 {

View File

@ -776,9 +776,10 @@ mod test {
.unwrap(); .unwrap();
let authorizer = move |ctx: AuthContext<'_>| match ctx.action { let authorizer = move |ctx: AuthContext<'_>| match ctx.action {
AuthAction::Read { column_name, .. } if column_name == "private" => { AuthAction::Read {
Authorization::Ignore column_name: "private",
} ..
} => Authorization::Ignore,
AuthAction::DropTable { .. } => Authorization::Deny, AuthAction::DropTable { .. } => Authorization::Deny,
AuthAction::Pragma { .. } => panic!("shouldn't be called"), AuthAction::Pragma { .. } => panic!("shouldn't be called"),
_ => Authorization::Allow, _ => Authorization::Allow,

View File

@ -40,7 +40,7 @@ pub struct InnerConnection {
unsafe impl Send for InnerConnection {} unsafe impl Send for InnerConnection {}
impl InnerConnection { impl InnerConnection {
#[allow(clippy::mutex_atomic)] #[allow(clippy::mutex_atomic, clippy::arc_with_non_send_sync)] // See unsafe impl Send / Sync for InterruptHandle
#[inline] #[inline]
pub unsafe fn new(db: *mut ffi::sqlite3, owned: bool) -> InnerConnection { pub unsafe fn new(db: *mut ffi::sqlite3, owned: bool) -> InnerConnection {
InnerConnection { InnerConnection {