Skip to content

Commit 21c54ec

Browse files
committed
Added Copy and Clone to structs that can have it
1 parent 39b2fc0 commit 21c54ec

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Diff for: src/sys/fanotify.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -271,18 +271,15 @@ pub const MAX_HANDLE_SZ: usize = 128;
271271

272272
/// Abstract over [`libc::fanotify_event_info_fid`], which represents an
273273
/// information record received via [`Fanotify::read_events_with_info_records`].
274-
#[derive(Debug, Eq, Hash, PartialEq)]
274+
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
275275
#[repr(transparent)]
276-
#[allow(missing_copy_implementations)]
277276
pub struct LibcFanotifyFidRecord(libc::fanotify_event_info_fid);
278277

279278
/// Extends LibcFanotifyFidRecord to include file_handle bytes.
280279
/// This allows Rust to move the record around in memory and not lose the file_handle
281280
/// as the libc::fanotify_event_info_fid does not include any of the file_handle bytes.
282-
// Is not Clone due to fd field, to avoid use-after-close scenarios.
283-
#[derive(Debug, Eq, Hash, PartialEq)]
281+
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
284282
#[repr(C)]
285-
#[allow(missing_copy_implementations)]
286283
pub struct FanotifyFidRecord {
287284
record: LibcFanotifyFidRecord,
288285
file_handle_bytes: [u8; MAX_HANDLE_SZ],
@@ -326,10 +323,8 @@ impl FanotifyFidRecord {
326323

327324
/// Abstract over [`libc::fanotify_event_info_error`], which represents an
328325
/// information record received via [`Fanotify::read_events_with_info_records`].
329-
// Is not Clone due to fd field, to avoid use-after-close scenarios.
330-
#[derive(Debug, Eq, Hash, PartialEq)]
326+
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
331327
#[repr(transparent)]
332-
#[allow(missing_copy_implementations)]
333328
#[cfg(target_env = "gnu")]
334329
pub struct FanotifyErrorRecord(libc::fanotify_event_info_error);
335330

@@ -350,7 +345,7 @@ impl FanotifyErrorRecord {
350345

351346
/// Abstract over [`libc::fanotify_event_info_pidfd`], which represents an
352347
/// information record received via [`Fanotify::read_events_with_info_records`].
353-
// Is not Clone due to fd field, to avoid use-after-close scenarios.
348+
// Is not Clone due to pidfd field, to avoid use-after-close scenarios.
354349
#[derive(Debug, Eq, Hash, PartialEq)]
355350
#[repr(transparent)]
356351
#[allow(missing_copy_implementations)]

0 commit comments

Comments
 (0)