Skip to content

Commit 035f651

Browse files
committed
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.
1 parent 589beb9 commit 035f651

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/libcore/num/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ assert_eq!(m, ", $reversed, ");
472472
#[unstable(feature = "reverse_bits", issue = "48763")]
473473
#[rustc_const_unstable(feature = "const_int_conversion")]
474474
#[inline]
475+
#[must_use]
475476
pub const fn reverse_bits(self) -> Self {
476477
(self as $UnsignedT).reverse_bits() as Self
477478
}
@@ -2521,6 +2522,7 @@ assert_eq!(m, ", $reversed, ");
25212522
```"),
25222523
#[unstable(feature = "reverse_bits", issue = "48763")]
25232524
#[inline]
2525+
#[must_use]
25242526
pub const fn reverse_bits(self) -> Self {
25252527
intrinsics::bitreverse(self as $ActualT) as Self
25262528
}

src/libcore/num/wrapping.rs

+1
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ assert_eq!(n.trailing_zeros(), 3);
524524
/// ```
525525
#[unstable(feature = "reverse_bits", issue = "48763")]
526526
#[inline]
527+
#[must_use]
527528
pub const fn reverse_bits(self) -> Self {
528529
Wrapping(self.0.reverse_bits())
529530
}

0 commit comments

Comments
 (0)