diff --git a/src/app.rs b/src/app.rs index 867f5f2..eaab3be 100644 --- a/src/app.rs +++ b/src/app.rs @@ -8,18 +8,10 @@ use std::collections::BTreeMap; use self::clap::{App, Arg, ArgGroup, AppSettings}; use super::{Slurp, RunOptions, compile, DEFAULT_SHELL, maybe_s}; -macro_rules! warn { - ($($arg:tt)*) => {{ - extern crate std; - use std::io::prelude::*; - let _ = writeln!(&mut std::io::stderr(), $($arg)*); - }}; -} - macro_rules! die { ($($arg:tt)*) => {{ extern crate std; - warn!($($arg)*); + eprintln!($($arg)*); process::exit(EXIT_FAILURE) }}; } @@ -235,7 +227,7 @@ pub fn app() { if matches.is_present("SUMMARY") { if justfile.count() == 0 { - warn!("Justfile contains no recipes."); + eprintln!("Justfile contains no recipes."); } else { println!("{}", justfile.recipes.keys().cloned().collect::>().join(" ")); } @@ -274,9 +266,9 @@ pub fn app() { process::exit(EXIT_SUCCESS); } None => { - warn!("Justfile does not contain recipe `{}`.", name); + eprintln!("Justfile does not contain recipe `{}`.", name); if let Some(suggestion) = justfile.suggest(name) { - warn!("Did you mean `{}`?", suggestion); + eprintln!("Did you mean `{}`?", suggestion); } process::exit(EXIT_FAILURE) } @@ -310,9 +302,9 @@ pub fn app() { if let Err(run_error) = justfile.run(&arguments, &options) { if !options.quiet { if color.stderr().active() { - warn!("{:#}", run_error); + eprintln!("{:#}", run_error); } else { - warn!("{}", run_error); + eprintln!("{}", run_error); } } diff --git a/src/lib.rs b/src/lib.rs index da585c9..4fd0eb2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,22 +51,6 @@ use std::collections::{BTreeMap as Map, BTreeSet as Set}; use std::fmt::Display; use std::ops::Range; -macro_rules! warn { - ($($arg:tt)*) => {{ - extern crate std; - use std::io::prelude::*; - let _ = writeln!(&mut std::io::stderr(), $($arg)*); - }}; -} - -macro_rules! die { - ($($arg:tt)*) => {{ - extern crate std; - warn!($($arg)*); - process::exit(EXIT_FAILURE) - }}; -} - const DEFAULT_SHELL: &'static str = "sh"; trait Slurp { @@ -290,7 +274,7 @@ impl<'a> Recipe<'a> { ) -> Result<(), RunError<'a>> { if options.verbose { let color = options.color.stderr().banner(); - warn!("{}===> Running recipe `{}`...{}", color.prefix(), self.name, color.suffix()); + eprintln!("{}===> Running recipe `{}`...{}", color.prefix(), self.name, color.suffix()); } let mut argument_map = Map::new(); @@ -333,7 +317,7 @@ impl<'a> Recipe<'a> { if options.dry_run || self.quiet { for line in &evaluated_lines { - warn!("{}", line); + eprintln!("{}", line); } } @@ -440,7 +424,7 @@ impl<'a> Recipe<'a> { } else { options.color }; - warn!("{}", color.stderr().paint(command)); + eprintln!("{}", color.stderr().paint(command)); } if options.dry_run {