Skip to content

Commit

Permalink
Fix clippy warnings (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
acrrd committed Feb 19, 2021
1 parent 3d32011 commit 92ce69d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/compaction_filter.rs
Expand Up @@ -100,7 +100,7 @@ pub unsafe extern "C" fn destructor_callback<F>(raw_cb: *mut c_void)
where
F: CompactionFilter,
{
let _: Box<F> = Box::from_raw(raw_cb as *mut F);
Box::from_raw(raw_cb as *mut F);
}

pub unsafe extern "C" fn name_callback<F>(raw_cb: *mut c_void) -> *const c_char
Expand Down
2 changes: 1 addition & 1 deletion src/compaction_filter_factory.rs
Expand Up @@ -30,7 +30,7 @@ pub unsafe extern "C" fn destructor_callback<F>(raw_self: *mut c_void)
where
F: CompactionFilterFactory,
{
let _: Box<F> = Box::from_raw(raw_self as *mut F);
Box::from_raw(raw_self as *mut F);
}

pub unsafe extern "C" fn name_callback<F>(raw_self: *mut c_void) -> *const c_char
Expand Down
3 changes: 1 addition & 2 deletions src/comparator.rs
Expand Up @@ -16,7 +16,6 @@
use libc::{c_char, c_int, c_void, size_t};
use std::cmp::Ordering;
use std::ffi::CString;
use std::mem;
use std::slice;

pub type CompareFn = fn(&[u8], &[u8]) -> Ordering;
Expand All @@ -27,7 +26,7 @@ pub struct ComparatorCallback {
}

pub unsafe extern "C" fn destructor_callback(raw_cb: *mut c_void) {
let _: Box<ComparatorCallback> = mem::transmute(raw_cb);
Box::from_raw(raw_cb as *mut ComparatorCallback);
}

pub unsafe extern "C" fn name_callback(raw_cb: *mut c_void) -> *const c_char {
Expand Down
5 changes: 2 additions & 3 deletions src/merge_operator.rs
Expand Up @@ -77,8 +77,7 @@ pub struct MergeOperatorCallback<F: MergeFn, PF: MergeFn> {
}

pub unsafe extern "C" fn destructor_callback<F: MergeFn, PF: MergeFn>(raw_cb: *mut c_void) {
let _: Box<MergeOperatorCallback<F, PF>> =
Box::from_raw(raw_cb as *mut MergeOperatorCallback<F, PF>);
Box::from_raw(raw_cb as *mut MergeOperatorCallback<F, PF>);
}

pub unsafe extern "C" fn delete_callback(
Expand All @@ -87,7 +86,7 @@ pub unsafe extern "C" fn delete_callback(
value_length: size_t,
) {
if !value.is_null() {
let _ = Box::from_raw(slice::from_raw_parts_mut(
Box::from_raw(slice::from_raw_parts_mut(
value as *mut u8,
value_length as usize,
));
Expand Down

0 comments on commit 92ce69d

Please sign in to comment.