Skip to content

Commit

Permalink
Fixed clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
carlvoller committed Dec 3, 2024
1 parent a9e5390 commit 7040b1e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/sys/fanotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,17 +500,15 @@ impl Fanotify {

fn get_struct<T>(&self, buffer: &[u8; 4096], offset: usize) -> T {
let struct_size = size_of::<T>();
let struct_obj = unsafe {
unsafe {
let mut struct_obj = MaybeUninit::<T>::uninit();
std::ptr::copy_nonoverlapping(
buffer.as_ptr().add(offset),
struct_obj.as_mut_ptr().cast(),
(4096 - offset).min(struct_size),
);
struct_obj.assume_init()
};

struct_obj
}
}

/// Read incoming events from the fanotify group.
Expand Down

0 comments on commit 7040b1e

Please sign in to comment.