macro_rules! use_prelude {
    () => {
        #[allow(unused_imports)]
        use crate::utils::prelude::*;
    };
}

macro_rules! inlined_modules {(
    $(
        $pub:vis
        mod
        $module_name:ident
        ;
    )*
) => (
    $(
        $pub use self::$module_name::*;
        mod $module_name;
    )*
)}

/// Scoped `use`
macro_rules! using {
    (
        match $expr:tt {
            use  $($path:tt)::+ ;
            $($match_body:tt)*
        }
    ) => (match $expr { expr => {
        use  $($path)::+ ;
        match expr { $($match_body)* }
    }});

    (
        match $expr:tt {
            use $($path:tt)::+ ;
            $($match_body:tt)*
        }
    ) => (match $expr { expr => {
        use $($path)::+;
        match expr { $($match_body)* }
    }});

    (
        :: $($path:tt)::+ in $($rest:tt)*
    ) => (
        const _: () = {
            use  $($path)::+ ;

            $($rest)*
        };
    );
    (
        $($path:tt)::+ in $($rest:tt)*
    ) => (
        const _: () = {
            use $($path)::+ ;

            $($rest)*
        };
    );
}

// macro_rules! FIXME {(
//     $($msg:expr),+ $(; $($body:tt)*)?
// ) => ({ #[deprecated(note = "FIXME")] struct __; let _ = __; ::tracing::warn!("FIXME: {}",
//   ::std::format_args!($($msg),*)); $($($body)*)?
// })}

#[allow(clippy::deprecated_cfg_attr)]
#[cfg_attr(rustfmt, rustfmt::skip)]
macro_rules! with_doc {(
    #[doc = $doc:expr]
    $item:item
) => (
    #[doc = $doc]
    $item
)}

macro_rules! trait_alias {(
    $( #[$attr:meta] )*
    $pub:vis
    trait $TraitName:ident = $($super:tt)*
) => (
    with_doc! {
        #[doc = concat!(
            "An alias for `", stringify!($($super)*), "`."
        )]
        $( #[$attr] )*
        $pub
        trait $TraitName
        where
            Self : $($super)*
        {}
    }

    impl<__ : ?Sized> $TraitName for __
    where
        Self : $($super)*
    {}
)}

#[macro_export]
macro_rules! event {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::event! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! error {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::error! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! warn {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::warn! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! info {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::info! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! debug {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::debug! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! trace {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::trace! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! span {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::span! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! error_span {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::error_span! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! warn_span {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::warn_span! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! info_span {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::info_span! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! debug_span {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::debug_span! { $($input)* }
        }
    };
}

#[macro_export]
macro_rules! trace_span {
    ( $($input:tt)* ) => {
        {
            #![allow(deprecated)]
            ::tracing::trace_span! { $($input)* }
        }
    };
}
