Skip to content
Permalink
Browse files

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.
  • Loading branch information...
nvzqz committed May 24, 2019
1 parent 589beb9 commit 035f651df77056d7d698e5ed47eb4b85d775fafa
Showing with 3 additions and 0 deletions.
  1. +2 −0 src/libcore/num/mod.rs
  2. +1 −0 src/libcore/num/wrapping.rs
@@ -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())
}

0 comments on commit 035f651

Please sign in to comment.
You can’t perform that action at this time.