Rollup merge of #61134 - nvzqz:reverse_bits-must_use, r=varkor
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 change was requested at https://github.com/rust-lang/rust/issues/48763#issuecomment-493743741.
This commit is contained in:
commit
92f1cfd039
@ -473,6 +473,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
|
||||
}
|
||||
@ -2522,6 +2523,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