diff --git a/ffi/src/lib.rs b/ffi/src/lib.rs index 3b77ad33..1bd3f049 100644 --- a/ffi/src/lib.rs +++ b/ffi/src/lib.rs @@ -913,9 +913,7 @@ pub unsafe extern "C" fn changelist_entry_at(tx_report: *mut TransactionChange, /// destroy function for releasing the memory for `repr(C)` structs. #[no_mangle] pub unsafe extern "C" fn destroy(obj: *mut c_void) { - if !obj.is_null() { - let _ = Box::from_raw(obj); - } + let _ = Box::from_raw(obj); } /// Creates a function with a given `$name` that releases the memroy for a type `$t`. @@ -923,7 +921,7 @@ macro_rules! define_destructor ( ($name:ident, $t:ty) => ( #[no_mangle] pub unsafe extern "C" fn $name(obj: *mut $t) { - if !obj.is_null() { let _ = Box::from_raw(obj); } + let _ = Box::from_raw(obj); } ) ); diff --git a/ffi/src/utils.rs b/ffi/src/utils.rs index 1a4abbf5..3dffd4b4 100644 --- a/ffi/src/utils.rs +++ b/ffi/src/utils.rs @@ -28,7 +28,7 @@ pub mod strings { CString::new(r_string.into()).unwrap().into_raw() } - pub fn kw_from_string(keyword_string: &'static str) -> NamespacedKeyword { + pub fn kw_from_string(keyword_string: &'static str) -> Keyword { // TODO: validate. The input might not be a keyword! let attr_name = keyword_string.trim_left_matches(":"); let parts: Vec<&str> = attr_name.split("/").collect();