diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 8c4a6e871e12..cc1f9ca79a15 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -2376,12 +2376,7 @@ macro_rules! uint_impl { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn checked_next_power_of_two(self) -> Option { - let npot = self.one_less_than_next_power_of_two().wrapping_add(1); - if npot >= self { - Some(npot) - } else { - None - } + self.one_less_than_next_power_of_two().checked_add(1) } } }