aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs
index 44f7b3de..ccb22cc9 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -13,6 +13,16 @@
// limitations under the License.
use std::cmp;
+#[cfg(not(feature = "nightly"))]
+#[inline(always)]
+#[cfg_attr(feature = "clippy", allow(inline_always))]
+pub unsafe fn unlikely(x: bool) -> bool {
+ x
+}
+
+#[cfg(feature = "nightly")]
+pub use ::std::intrinsics::unlikely;
+
/// Threading utilities
pub mod thread {
/// Like `thread::spawn`, but with a `name` argument