Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings #498

Merged
merged 1 commit into from Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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