diff --git a/src/raw/mod.rs b/src/raw/mod.rs index eaebaf719..770823761 100644 --- a/src/raw/mod.rs +++ b/src/raw/mod.rs @@ -44,32 +44,12 @@ use self::imp::Group; // Branch prediction hint. This is currently only available on nightly but it // consistently improves performance by 10-15%. -#[cfg(feature = "nightly")] -use core::intrinsics::{likely, unlikely}; - -// On stable we can use #[cold] to get a equivalent effect: this attributes -// suggests that the function is unlikely to be called #[cfg(not(feature = "nightly"))] -#[inline] -#[cold] -fn cold() {} - -#[cfg(not(feature = "nightly"))] -#[inline] -fn likely(b: bool) -> bool { - if !b { - cold(); - } - b -} +use core::convert::identity as likely; #[cfg(not(feature = "nightly"))] -#[inline] -fn unlikely(b: bool) -> bool { - if b { - cold(); - } - b -} +use core::convert::identity as unlikely; +#[cfg(feature = "nightly")] +use core::intrinsics::{likely, unlikely}; // Use strict provenance functions if available. #[cfg(feature = "nightly")]