Skip to content

Commit cb50cf3

Browse files
committed
NotAllOnes cheaper as_inner
1 parent 6db768e commit cb50cf3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/num/niche_types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ macro_rules! define_valid_range_type {
5858
pub const fn as_inner(self) -> $int {
5959
// SAFETY: This is a transparent wrapper, so unwrapping it is sound
6060
// (Not using `.0` due to MCP#807.)
61-
unsafe { crate::mem::transmute(self) }
61+
// SAFETY: size is already asserted in the const block above
62+
unsafe { crate::intrinsics::transmute_unchecked(self) }
6263
}
6364
}
6465

0 commit comments

Comments
 (0)