Fix clippy warnings (#498)

master
Andrea Corradi 4 years ago committed by GitHub
parent 3d32011909
commit 92ce69d7c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/compaction_filter.rs
  2. 2
      src/compaction_filter_factory.rs
  3. 3
      src/comparator.rs
  4. 3
      src/merge_operator.rs

@ -100,7 +100,7 @@ pub unsafe extern "C" fn destructor_callback<F>(raw_cb: *mut c_void)
where where
F: CompactionFilter, 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 pub unsafe extern "C" fn name_callback<F>(raw_cb: *mut c_void) -> *const c_char

@ -30,7 +30,7 @@ pub unsafe extern "C" fn destructor_callback<F>(raw_self: *mut c_void)
where where
F: CompactionFilterFactory, 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 pub unsafe extern "C" fn name_callback<F>(raw_self: *mut c_void) -> *const c_char

@ -16,7 +16,6 @@
use libc::{c_char, c_int, c_void, size_t}; use libc::{c_char, c_int, c_void, size_t};
use std::cmp::Ordering; use std::cmp::Ordering;
use std::ffi::CString; use std::ffi::CString;
use std::mem;
use std::slice; use std::slice;
pub type CompareFn = fn(&[u8], &[u8]) -> Ordering; pub type CompareFn = fn(&[u8], &[u8]) -> Ordering;
@ -27,7 +26,7 @@ pub struct ComparatorCallback {
} }
pub unsafe extern "C" fn destructor_callback(raw_cb: *mut c_void) { 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 { pub unsafe extern "C" fn name_callback(raw_cb: *mut c_void) -> *const c_char {

@ -77,7 +77,6 @@ pub struct MergeOperatorCallback<F: MergeFn, PF: MergeFn> {
} }
pub unsafe extern "C" fn destructor_callback<F: MergeFn, PF: MergeFn>(raw_cb: *mut c_void) { 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>);
} }
@ -87,7 +86,7 @@ pub unsafe extern "C" fn delete_callback(
value_length: size_t, value_length: size_t,
) { ) {
if !value.is_null() { 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 as *mut u8,
value_length as usize, value_length as usize,
)); ));

Loading…
Cancel
Save