Move stdx macros into submodule

This commit is contained in:
Aleksey Kladov 2020-07-13 15:54:12 +02:00
parent 4b1c372436
commit 6b4cf5b7d8
2 changed files with 21 additions and 19 deletions

19
crates/stdx/src/macros.rs Normal file
View file

@ -0,0 +1,19 @@
//! Convenience macros.
#[macro_export]
macro_rules! eprintln {
($($tt:tt)*) => {{
if $crate::is_ci() {
panic!("Forgot to remove debug-print?")
}
std::eprintln!($($tt)*)
}}
}
/// Appends formatted string to a `String`.
#[macro_export]
macro_rules! format_to {
($buf:expr) => ();
($buf:expr, $lit:literal $($arg:tt)*) => {
{ use ::std::fmt::Write as _; let _ = ::std::write!($buf, $lit $($arg)*); }
};
}