Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
joehoyle committed May 12, 2023
1 parent 246ae2d commit 7a1f566
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/types/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::{
ffi::CString,
fmt::Debug,
iter::FromIterator,
ptr::NonNull,
u64,
};

Expand All @@ -16,8 +15,8 @@ use crate::{
convert::{FromZval, IntoZval},
error::{Error, Result},
ffi::{
_Bucket, _zend_new_array, zend_array_count, zend_array_destroy, zend_array_dup,
zend_hash_clean, zend_hash_get_current_data_ex, zend_hash_get_current_key_type_ex,
_zend_new_array, zend_array_count, zend_array_destroy, zend_array_dup, zend_hash_clean,
zend_hash_get_current_data_ex, zend_hash_get_current_key_type_ex,
zend_hash_get_current_key_zval_ex, zend_hash_index_del, zend_hash_index_find,
zend_hash_index_update, zend_hash_move_backwards_ex, zend_hash_move_forward_ex,
zend_hash_next_index_insert, zend_hash_str_del, zend_hash_str_find, zend_hash_str_update,
Expand Down Expand Up @@ -119,8 +118,7 @@ impl ZendHashTable {
/// assert_eq!(ht.len(), 2);
/// ```
pub fn len(&self) -> usize {
return unsafe { zend_array_count(self as *const ZendHashTable as *mut ZendHashTable) }
as usize;
unsafe { zend_array_count(self as *const ZendHashTable as *mut ZendHashTable) as usize }
}

/// Returns whether the hash table is empty.
Expand Down Expand Up @@ -534,11 +532,11 @@ impl<'a> Iter<'a> {
///
/// * `ht` - The hashtable to iterate.
pub fn new(ht: &'a ZendHashTable) -> Self {
return Self {
Self {
ht,
current_num: 0,
pos: 0,
};
}
}
}

Expand Down Expand Up @@ -582,9 +580,9 @@ impl<'a> Iterator for Iter<'a> {
&mut self.pos as *mut HashPosition,
)
};
self.current_num = self.current_num + 1;
self.current_num += 1;

return Some(r);
Some(r)
}

fn count(self) -> usize
Expand Down Expand Up @@ -639,9 +637,9 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
&mut self.pos as *mut HashPosition,
)
};
self.current_num = self.current_num - 1;
self.current_num -= 1;

return Some(r);
Some(r)
}
}

Expand Down

0 comments on commit 7a1f566

Please sign in to comment.