mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
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:
parent
589beb979c
commit
035f651df7
@ -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
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user