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/time.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/sys/time.rs') diff --git a/src/sys/time.rs b/src/sys/time.rs index c786500a..ac424718 100644 --- a/src/sys/time.rs +++ b/src/sys/time.rs @@ -187,11 +187,11 @@ impl TimeSpec { } #[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848 - pub fn tv_sec(&self) -> time_t { + pub const fn tv_sec(&self) -> time_t { self.0.tv_sec } - pub fn tv_nsec(&self) -> timespec_tv_nsec_t { + pub const fn tv_nsec(&self) -> timespec_tv_nsec_t { self.0.tv_nsec } @@ -404,11 +404,11 @@ impl TimeVal { } #[cfg_attr(target_env = "musl", allow(deprecated))] // https://github.com/rust-lang/libc/issues/1848 - pub fn tv_sec(&self) -> time_t { + pub const fn tv_sec(&self) -> time_t { self.0.tv_sec } - pub fn tv_usec(&self) -> suseconds_t { + pub const fn tv_usec(&self) -> suseconds_t { self.0.tv_usec } } -- cgit v1.2.3