1#![deny(warnings)]
5#![allow(unused_features)]
6#![warn(clippy::all, clippy::pedantic)]
7#![allow(clippy::inline_always)]
8#![no_std]
9
10#[macro_export]
12macro_rules! debug_check_or_release_hint {
13 ($condition:expr) => {
14 #[cfg(debug_assertions)]
15 {
16 assert!($condition);
17 }
18
19 #[cfg(not(debug_assertions))]
20 unsafe {
21 ::core::hint::assert_unchecked($condition);
22 }
23 };
24 ($condition:expr, $msg: literal) => {
25 #[cfg(debug_assertions)]
26 {
27 assert!($condition, $msg);
28 }
29
30 #[cfg(not(debug_assertions))]
31 unsafe {
32 ::core::hint::assert_unchecked($condition);
33 }
34 };
35}
36
37#[macro_export]
39macro_rules! unreachable_from_infallible {
40 ($ty:ty) => {
41 impl From<::core::convert::Infallible> for $ty {
42 #[inline]
43 fn from(_: ::core::convert::Infallible) -> Self {
44 unreachable!("From<Infallible> for {} is not possible", stringify!($ty));
45 }
46 }
47 };
48}