This commit is contained in:
Daniil Gentili 2023-10-10 15:07:44 +03:00
parent e820b2458a
commit 85836dad04
5 changed files with 9 additions and 8 deletions

View File

@ -32,7 +32,7 @@ impl<T> Deref for Vec<T> {
impl<T> Drop for Vec<T> { impl<T> Drop for Vec<T> {
fn drop(&mut self) { 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)); };
} }
} }

View File

@ -52,7 +52,7 @@ impl ToStub for Module {
// Inserts a value into the entries hashmap. Takes a key and an entry, creating // Inserts a value into the entries hashmap. Takes a key and an entry, creating
// the internal vector if it doesn't already exist. // the internal vector if it doesn't already exist.
let mut insert = |ns, entry| { 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); bucket.push(entry);
}; };

View File

@ -768,7 +768,7 @@ impl<'a> FromZval<'a> for &'a ZendHashTable {
} }
/////////////////////////////////////////// ///////////////////////////////////////////
//// HashMap /// HashMap
/////////////////////////////////////////// ///////////////////////////////////////////
impl<'a, V> TryFrom<&'a ZendHashTable> for HashMap<String, V> impl<'a, V> TryFrom<&'a ZendHashTable> for HashMap<String, V>
@ -837,7 +837,7 @@ where
} }
/////////////////////////////////////////// ///////////////////////////////////////////
//// Vec /// Vec
/////////////////////////////////////////// ///////////////////////////////////////////
impl<'a, T> TryFrom<&'a ZendHashTable> for Vec<T> impl<'a, T> TryFrom<&'a ZendHashTable> for Vec<T>

View File

@ -34,6 +34,7 @@ impl ClassEntry {
/// # Panics /// # Panics
/// ///
/// Panics when allocating memory for the new object fails. /// Panics when allocating memory for the new object fails.
#[allow(clippy::new_ret_no_self)]
pub fn new(&self) -> ZBox<ZendObject> { pub fn new(&self) -> ZBox<ZendObject> {
ZendObject::new(self) ZendObject::new(self)
} }

View File

@ -56,11 +56,11 @@ impl Function {
if res.is_null() { if res.is_null() {
return None; return None;
} }
return Some(*res); Some(*res)
} }
} }
pub fn try_from_method(class: &str, name: &str) -> Option<Self> { pub fn try_from_method(class: &str, name: &str) -> Option<Self> {
return match ClassEntry::try_find(class) { match ClassEntry::try_find(class) {
None => None, None => None,
Some(ce) => unsafe { Some(ce) => unsafe {
let res = zend_hash_str_find_ptr_lc( let res = zend_hash_str_find_ptr_lc(
@ -71,9 +71,9 @@ impl Function {
if res.is_null() { if res.is_null() {
return None; return None;
} }
return Some(*res); Some(*res)
}, },
}; }
} }
pub fn from_function(name: &str) -> Self { pub fn from_function(name: &str) -> Self {