Rollup merge of #89897 - jkugelman:must-use-core, r=joshtriplett
Add #[must_use] to remaining core functions I've run out of compelling reasons to group functions together across crates so I'm just going to go module-by-module. This is everything remaining from the `core` crate. Ignored by clippy for reasons unknown: ```rust core::alloc::Layout unsafe fn for_value_raw<T: ?Sized>(t: *const T) -> Self; core::any const fn type_name_of_val<T: ?Sized>(_val: &T) -> &'static str; ``` Ignored by clippy because of `mut`: ```rust str fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str); ``` <del> Ignored by clippy presumably because a caller might want `f` called for side effects. That seems like a bad usage of `map` to me. ```rust core::cell::Ref<'b, T> fn map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Ref<'b, T>; core::cell::Ref<'b, T> fn map_split<U: ?Sized, V: ?Sized, F>(orig: Ref<'b, T>, f: F) -> (Ref<'b, U>, Ref<'b, V>); ``` </del> Parent issue: #89692 r? ```@joshtriplett```
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user