Annotate each reverse_bits with #[must_use]

Because the name sounds like an in-place mutation like
`[T]::reverse(&mut self)`, it may be confused for one.
This commit is contained in:
Nikolai Vazquez 2019-05-24 22:26:34 +02:00
parent 589beb979c
commit 035f651df7
2 changed files with 3 additions and 0 deletions

View File

@ -472,6 +472,7 @@ assert_eq!(m, ", $reversed, ");
#[unstable(feature = "reverse_bits", issue = "48763")]
#[rustc_const_unstable(feature = "const_int_conversion")]
#[inline]
#[must_use]
pub const fn reverse_bits(self) -> Self {
(self as $UnsignedT).reverse_bits() as Self
}
@ -2521,6 +2522,7 @@ assert_eq!(m, ", $reversed, ");
```"),
#[unstable(feature = "reverse_bits", issue = "48763")]
#[inline]
#[must_use]
pub const fn reverse_bits(self) -> Self {
intrinsics::bitreverse(self as $ActualT) as Self
}

View File

@ -524,6 +524,7 @@ assert_eq!(n.trailing_zeros(), 3);
/// ```
#[unstable(feature = "reverse_bits", issue = "48763")]
#[inline]
#[must_use]
pub const fn reverse_bits(self) -> Self {
Wrapping(self.0.reverse_bits())
}