From bf569f8b29d05782597d40ec98ee33bc2574763e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 6 Apr 2020 16:58:16 +0200 Subject: Check for eprintln on CI --- crates/stdx/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crates/stdx') 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 @@ use std::{cell::Cell, fmt}; +#[inline(always)] +pub fn is_ci() -> bool { + option_env!("CI").is_some() +} + +#[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 { -- cgit v1.2.3