Add #[must_use] to remaining core functions

This commit is contained in:
John Kugelman
2021-10-14 18:54:55 -04:00
parent e1e9319d93
commit 68b0d86294
25 changed files with 52 additions and 1 deletions

View File

@@ -357,6 +357,7 @@ impl Duration {
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
#[rustc_const_stable(feature = "duration_extras", since = "1.32.0")]
#[must_use]
#[inline]
pub const fn subsec_millis(&self) -> u32 {
self.nanos / NANOS_PER_MILLI
@@ -379,6 +380,7 @@ impl Duration {
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
#[rustc_const_stable(feature = "duration_extras", since = "1.32.0")]
#[must_use]
#[inline]
pub const fn subsec_micros(&self) -> u32 {
self.nanos / NANOS_PER_MICRO
@@ -401,6 +403,7 @@ impl Duration {
/// ```
#[stable(feature = "duration", since = "1.3.0")]
#[rustc_const_stable(feature = "duration", since = "1.32.0")]
#[must_use]
#[inline]
pub const fn subsec_nanos(&self) -> u32 {
self.nanos