From b2799b5b59c0c59700b48ae31da56871f732b250 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Wed, 11 Sep 2024 21:23:28 +0200 Subject: [PATCH] chore: likely hints don't work on stable --- src/lib.rs | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 208cf62..98dca66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -101,31 +101,8 @@ cfg_if! { }; } } else { - // On stable we can use #[cold] to get a equivalent effect: this attribute - // suggests that the function is unlikely to be called - #[inline(always)] - #[cold] - #[allow(clippy::missing_const_for_fn)] - fn cold() {} - - #[inline(always)] - #[allow(dead_code)] - #[allow(clippy::missing_const_for_fn)] - fn likely(b: bool) -> bool { - if !b { - cold(); - } - b - } - - #[inline(always)] - #[allow(clippy::missing_const_for_fn)] - fn unlikely(b: bool) -> bool { - if b { - cold(); - } - b - } + #[allow(unused_imports)] + use core::convert::{identity as likely, identity as unlikely}; macro_rules! maybe_const_assert { ($($tt:tt)*) => {