mirror of
https://github.com/isar/rusqlite.git
synced 2025-12-19 09:55:09 +08:00
clippy:ptr_as_ptr
This commit is contained in:
@@ -10,7 +10,7 @@ use crate::{str_to_cstring, Connection, InnerConnection, Result};
|
||||
|
||||
// FIXME copy/paste from function.rs
|
||||
unsafe extern "C" fn free_boxed_value<T>(p: *mut c_void) {
|
||||
drop(Box::from_raw(p as *mut T));
|
||||
drop(Box::from_raw(p.cast::<T>()));
|
||||
}
|
||||
|
||||
impl Connection {
|
||||
@@ -57,14 +57,14 @@ impl InnerConnection {
|
||||
C: Fn(&str, &str) -> Ordering,
|
||||
{
|
||||
let r = catch_unwind(|| {
|
||||
let boxed_f: *mut C = arg1 as *mut C;
|
||||
let boxed_f: *mut C = arg1.cast::<C>();
|
||||
assert!(!boxed_f.is_null(), "Internal error - null function pointer");
|
||||
let s1 = {
|
||||
let c_slice = slice::from_raw_parts(arg3 as *const u8, arg2 as usize);
|
||||
let c_slice = slice::from_raw_parts(arg3.cast::<u8>(), arg2 as usize);
|
||||
String::from_utf8_lossy(c_slice)
|
||||
};
|
||||
let s2 = {
|
||||
let c_slice = slice::from_raw_parts(arg5 as *const u8, arg4 as usize);
|
||||
let c_slice = slice::from_raw_parts(arg5.cast::<u8>(), arg4 as usize);
|
||||
String::from_utf8_lossy(c_slice)
|
||||
};
|
||||
(*boxed_f)(s1.as_ref(), s2.as_ref())
|
||||
@@ -91,7 +91,7 @@ impl InnerConnection {
|
||||
self.db(),
|
||||
c_name.as_ptr(),
|
||||
flags,
|
||||
boxed_f as *mut c_void,
|
||||
boxed_f.cast::<c_void>(),
|
||||
Some(call_boxed_closure::<C>),
|
||||
Some(free_boxed_value::<C>),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user