Skip to content

Commit 5e37b43

Browse files
committed
lint: fix clippy::ptr_as_ptr
1 parent 6e939df commit 5e37b43

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ dbg_macro = "warn"
1919
pedantic = {level = "warn", priority = -1}
2020
inline_always = "allow" # TODO: benchmark inlines
2121
missing_panics_doc = "allow" # TODO
22-
ptr_as_ptr = "allow" # 3
2322
similar_names = "allow" # 26
2423
float_cmp = "allow" # 41
2524
map_unwrap_or = "allow" # 56

src/ffi.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,12 @@ mod enabled {
334334
let mut out_values = out_values;
335335
out_values.pop().unwrap()
336336
} else {
337-
[ret].into_iter().chain(out_values).map(Boxed).collect::<Array<_>>().into()
337+
[ret]
338+
.into_iter()
339+
.chain(out_values)
340+
.map(Boxed)
341+
.collect::<Array<_>>()
342+
.into()
338343
}
339344
};
340345

@@ -420,7 +425,7 @@ mod enabled {
420425
libffi::raw::ffi_call(
421426
cif.as_raw_ptr(),
422427
Some(*fun.as_safe_fun()),
423-
result.as_mut_ptr() as *mut c_void,
428+
result.as_mut_ptr().cast(),
424429
args.as_ptr() as *mut *mut c_void,
425430
);
426431
result
@@ -467,10 +472,11 @@ mod enabled {
467472
FfiType::ULongLong => arr!(c_ulonglong),
468473
_ => Ok(if ptr.ty.is_string() {
469474
(0..len)
470-
.map(|index| ptr.ty.unrepr(&repr[index * size..(index + 1) * size]))
471-
.collect::<Result<Vec<_>, String>>()?
472-
.into_iter()
473-
.map(Boxed).collect()
475+
.map(|index| ptr.ty.unrepr(&repr[index * size..(index + 1) * size]))
476+
.collect::<Result<Vec<_>, String>>()?
477+
.into_iter()
478+
.map(Boxed)
479+
.collect()
474480
} else {
475481
Value::from_row_values_infallible(
476482
(0..len)

src/value.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,14 @@ impl Deref for Value {
364364
type Target = ValueRepr;
365365
fn deref(&self) -> &Self::Target {
366366
// Safety: The layout of `Value` should always match that of `Value`
367-
unsafe { &*(std::ptr::from_ref(self) as *const ValueRepr) }
367+
unsafe { &*std::ptr::from_ref(self).cast() }
368368
}
369369
}
370370

371371
impl DerefMut for Value {
372372
fn deref_mut(&mut self) -> &mut Self::Target {
373373
// Safety: The layout of `Value` should always match that of `Value`
374-
unsafe { &mut *(std::ptr::from_mut(self) as *mut ValueRepr) }
374+
unsafe { &mut *std::ptr::from_mut(self).cast() }
375375
}
376376
}
377377

0 commit comments

Comments
 (0)