diff options
author | Aleksey Kladov <[email protected]> | 2020-04-06 16:21:47 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-06 16:21:47 +0100 |
commit | 109bb1a7935e31d4ee3c036775a89ad0ac0e012b (patch) | |
tree | 28160f40d1cf3127304456ec3d2a171fc7948c61 /crates/stdx | |
parent | f6d688d13070a54b288486900a30680d013c66ca (diff) | |
parent | 1b2d255be168333c136677599d2ea8b5a3f5996b (diff) |
Merge pull request #3867 from matklad/deny-eprintln
Check for eprintlns on CI
Diffstat (limited to 'crates/stdx')
-rw-r--r-- | crates/stdx/src/lib.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index d2efa2236..401a568bd 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs | |||
@@ -2,6 +2,21 @@ | |||
2 | 2 | ||
3 | use std::{cell::Cell, fmt}; | 3 | use std::{cell::Cell, fmt}; |
4 | 4 | ||
5 | #[inline(always)] | ||
6 | pub fn is_ci() -> bool { | ||
7 | option_env!("CI").is_some() | ||
8 | } | ||
9 | |||
10 | #[macro_export] | ||
11 | macro_rules! eprintln { | ||
12 | ($($tt:tt)*) => {{ | ||
13 | if $crate::is_ci() { | ||
14 | panic!("Forgot to remove debug-print?") | ||
15 | } | ||
16 | std::eprintln!($($tt)*) | ||
17 | }} | ||
18 | } | ||
19 | |||
5 | /// Appends formatted string to a `String`. | 20 | /// Appends formatted string to a `String`. |
6 | #[macro_export] | 21 | #[macro_export] |
7 | macro_rules! format_to { | 22 | macro_rules! format_to { |