chore(lib): apply clippy fixes

This commit is contained in:
Amaan Qureshi 2024-02-04 01:30:46 -05:00
parent 04ff704bca
commit 28bb2a8c1c
No known key found for this signature in database
GPG key ID: E67890ADC4227273
4 changed files with 303 additions and 172 deletions

View file

@ -9,7 +9,7 @@ pub struct CBufferIter<T> {
}
impl<T> CBufferIter<T> {
pub unsafe fn new(ptr: *mut T, count: usize) -> Self {
pub const unsafe fn new(ptr: *mut T, count: usize) -> Self {
Self { ptr, count, i: 0 }
}
}
@ -23,7 +23,7 @@ impl<T: Copy> Iterator for CBufferIter<T> {
None
} else {
self.i += 1;
Some(unsafe { *self.ptr.offset(i as isize) })
Some(unsafe { *self.ptr.add(i) })
}
}
@ -38,7 +38,7 @@ impl<T: Copy> ExactSizeIterator for CBufferIter<T> {}
impl<T> Drop for CBufferIter<T> {
fn drop(&mut self) {
if !self.ptr.is_null() {
unsafe { (FREE_FN)(self.ptr as *mut c_void) };
unsafe { (FREE_FN)(self.ptr.cast::<c_void>()) };
}
}
}