macro_rules! println_ignore_io_error {
($($tt:tt)*) => {{
use std::io::Write;
let _ = writeln!(std::io::stdout(), $($tt)*);
}}
}
macro_rules! eprintln_ignore_io_error {
($($tt:tt)*) => {{
use std::io::Write;
let _ = writeln!(std::io::stderr(), $($tt)*);
}}
}
#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! eprintln {
($($tt:tt)*) => {
compile_error!("do not use `eprintln!`; use the `write!` macro instead")
};
}
#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! eprint {
($($tt:tt)*) => {
compile_error!("do not use `eprint!`; use the `write!` macro instead")
};
}
#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! println {
($($tt:tt)*) => {
compile_error!("do not use `println!`; use the `write!` macro instead")
};
}
#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! print {
($($tt:tt)*) => {
compile_error!("do not use `print!`; use the `write!` macro instead")
};
}
macro_rules! cstr {
($lit:literal) => {{
const CS: &'static std::ffi::CStr =
match std::ffi::CStr::from_bytes_until_nul(concat!($lit, "\0").as_bytes()) {
Ok(x) => x,
Err(_) => panic!("string literal did not pass CStr checks"),
};
CS
}};
}