From 92ce69d7c44804d20e22b572259c950f9fdb591f Mon Sep 17 00:00:00 2001 From: Andrea Corradi Date: Fri, 19 Feb 2021 07:55:10 +0100 Subject: [PATCH] Fix clippy warnings (#498) --- src/compaction_filter.rs | 2 +- src/compaction_filter_factory.rs | 2 +- src/comparator.rs | 3 +-- src/merge_operator.rs | 5 ++--- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/compaction_filter.rs b/src/compaction_filter.rs index 7e39a56..3e82730 100644 --- a/src/compaction_filter.rs +++ b/src/compaction_filter.rs @@ -100,7 +100,7 @@ pub unsafe extern "C" fn destructor_callback(raw_cb: *mut c_void) where F: CompactionFilter, { - let _: Box = Box::from_raw(raw_cb as *mut F); + Box::from_raw(raw_cb as *mut F); } pub unsafe extern "C" fn name_callback(raw_cb: *mut c_void) -> *const c_char diff --git a/src/compaction_filter_factory.rs b/src/compaction_filter_factory.rs index fba25a2..e739f24 100644 --- a/src/compaction_filter_factory.rs +++ b/src/compaction_filter_factory.rs @@ -30,7 +30,7 @@ pub unsafe extern "C" fn destructor_callback(raw_self: *mut c_void) where F: CompactionFilterFactory, { - let _: Box = Box::from_raw(raw_self as *mut F); + Box::from_raw(raw_self as *mut F); } pub unsafe extern "C" fn name_callback(raw_self: *mut c_void) -> *const c_char diff --git a/src/comparator.rs b/src/comparator.rs index 142922b..330a95f 100644 --- a/src/comparator.rs +++ b/src/comparator.rs @@ -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; @@ -27,7 +26,7 @@ pub struct ComparatorCallback { } pub unsafe extern "C" fn destructor_callback(raw_cb: *mut c_void) { - let _: Box = 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 { diff --git a/src/merge_operator.rs b/src/merge_operator.rs index e78a23b..5ee93e8 100644 --- a/src/merge_operator.rs +++ b/src/merge_operator.rs @@ -77,8 +77,7 @@ pub struct MergeOperatorCallback { } pub unsafe extern "C" fn destructor_callback(raw_cb: *mut c_void) { - let _: Box> = - Box::from_raw(raw_cb as *mut MergeOperatorCallback); + Box::from_raw(raw_cb as *mut MergeOperatorCallback); } pub unsafe extern "C" fn delete_callback( @@ -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, ));