From 358adafa279ff3e6898ed49f4a2140144f121e9c Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 24 Jul 2021 14:43:02 -0600 Subject: Mark most C-derived enums as non_exhaustive Since libc may add new variants at any time, Nix's consumers should not use exhaustive match patterns. Fixes #1182 --- src/sys/timerfd.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/sys/timerfd.rs') diff --git a/src/sys/timerfd.rs b/src/sys/timerfd.rs index 44915be1..030e5976 100644 --- a/src/sys/timerfd.rs +++ b/src/sys/timerfd.rs @@ -58,6 +58,7 @@ libc_enum! { /// The type of the clock used to mark the progress of the timer. For more /// details on each kind of clock, please refer to [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html). #[repr(i32)] + #[non_exhaustive] pub enum ClockId { CLOCK_REALTIME, CLOCK_MONOTONIC, -- cgit v1.2.3 From 86acc26cbcadfd572d6af93ba34467a3cdac8b4e Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 24 Jul 2021 16:47:26 -0600 Subject: Constify many functions Constify most functions that can be constified. The exceptions are mostly accessors for structs that have no const constructor. --- src/sys/timerfd.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sys/timerfd.rs') diff --git a/src/sys/timerfd.rs b/src/sys/timerfd.rs index 44915be1..3e1a1558 100644 --- a/src/sys/timerfd.rs +++ b/src/sys/timerfd.rs @@ -87,7 +87,7 @@ bitflags! { struct TimerSpec(libc::itimerspec); impl TimerSpec { - pub fn none() -> Self { + pub const fn none() -> Self { Self(libc::itimerspec { it_interval: libc::timespec { tv_sec: 0, -- cgit v1.2.3