From 85836dad04e2b30ad7476c1dcf823015c6c882cb Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Tue, 10 Oct 2023 15:07:44 +0300 Subject: [PATCH] Fix --- src/describe/abi.rs | 2 +- src/describe/stub.rs | 2 +- src/types/array.rs | 4 ++-- src/zend/class.rs | 1 + src/zend/function.rs | 8 ++++---- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/describe/abi.rs b/src/describe/abi.rs index a4e5885..1176710 100644 --- a/src/describe/abi.rs +++ b/src/describe/abi.rs @@ -32,7 +32,7 @@ impl Deref for Vec { impl Drop for Vec { fn drop(&mut self) { - unsafe { Box::from_raw(std::ptr::slice_from_raw_parts_mut(self.ptr, self.len)) }; + unsafe { let _ = Box::from_raw(std::ptr::slice_from_raw_parts_mut(self.ptr, self.len)); }; } } diff --git a/src/describe/stub.rs b/src/describe/stub.rs index 65c0e76..065b275 100644 --- a/src/describe/stub.rs +++ b/src/describe/stub.rs @@ -52,7 +52,7 @@ impl ToStub for Module { // Inserts a value into the entries hashmap. Takes a key and an entry, creating // the internal vector if it doesn't already exist. let mut insert = |ns, entry| { - let bucket = entries.entry(ns).or_insert_with(StdVec::new); + let bucket = entries.entry(ns).or_default(); bucket.push(entry); }; diff --git a/src/types/array.rs b/src/types/array.rs index c9f7b41..c40b8f3 100644 --- a/src/types/array.rs +++ b/src/types/array.rs @@ -768,7 +768,7 @@ impl<'a> FromZval<'a> for &'a ZendHashTable { } /////////////////////////////////////////// -//// HashMap +/// HashMap /////////////////////////////////////////// impl<'a, V> TryFrom<&'a ZendHashTable> for HashMap @@ -837,7 +837,7 @@ where } /////////////////////////////////////////// -//// Vec +/// Vec /////////////////////////////////////////// impl<'a, T> TryFrom<&'a ZendHashTable> for Vec diff --git a/src/zend/class.rs b/src/zend/class.rs index b54ad4c..4c3c23d 100644 --- a/src/zend/class.rs +++ b/src/zend/class.rs @@ -34,6 +34,7 @@ impl ClassEntry { /// # Panics /// /// Panics when allocating memory for the new object fails. + #[allow(clippy::new_ret_no_self)] pub fn new(&self) -> ZBox { ZendObject::new(self) } diff --git a/src/zend/function.rs b/src/zend/function.rs index 9321e1a..e7ff767 100644 --- a/src/zend/function.rs +++ b/src/zend/function.rs @@ -56,11 +56,11 @@ impl Function { if res.is_null() { return None; } - return Some(*res); + Some(*res) } } pub fn try_from_method(class: &str, name: &str) -> Option { - return match ClassEntry::try_find(class) { + match ClassEntry::try_find(class) { None => None, Some(ce) => unsafe { let res = zend_hash_str_find_ptr_lc( @@ -71,9 +71,9 @@ impl Function { if res.is_null() { return None; } - return Some(*res); + Some(*res) }, - }; + } } pub fn from_function(name: &str) -> Self {