Debian Codegraph @

src/macros.rs

raw symbols SCIP
1 // the `std::print` macros panic on any IO error. these are non-panicking alternatives
2 macro_rules! println_ignore_io_error {
3 ($($tt:tt)*) => {{
4 use std::io::Write;
5 let _ = writeln!(std::io::stdout(), $($tt)*);
6 }}
7 }
8
9 macro_rules! eprintln_ignore_io_error {
10 ($($tt:tt)*) => {{
11 use std::io::Write;
12 let _ = writeln!(std::io::stderr(), $($tt)*);
13 }}
14 }
15
16 // catch unintentional uses of `print*` macros with the test suite
17 #[allow(unused_macros)]
18 #[cfg(debug_assertions)]
19 macro_rules! eprintln {
20 ($($tt:tt)*) => {
21 compile_error!("do not use `eprintln!`; use the `write!` macro instead")
22 };
23 }
24
25 #[allow(unused_macros)]
26 #[cfg(debug_assertions)]
27 macro_rules! eprint {
28 ($($tt:tt)*) => {
29 compile_error!("do not use `eprint!`; use the `write!` macro instead")
30 };
31 }
32
33 #[allow(unused_macros)]
34 #[cfg(debug_assertions)]
35 macro_rules! println {
36 ($($tt:tt)*) => {
37 compile_error!("do not use `println!`; use the `write!` macro instead")
38 };
39 }
40
41 #[allow(unused_macros)]
42 #[cfg(debug_assertions)]
43 macro_rules! print {
44 ($($tt:tt)*) => {
45 compile_error!("do not use `print!`; use the `write!` macro instead")
46 };
47 }