From a3060f952edc6347a1da8e2dff6d0fab2725f494 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Fri, 3 Apr 2020 11:41:22 +0200 Subject: [PATCH] Move error macros to error.rs --- src/error.rs | 10 ++++++++++ src/internal/mod.rs | 11 ----------- src/main.rs | 3 ++- 3 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 src/error.rs diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..aad963b --- /dev/null +++ b/src/error.rs @@ -0,0 +1,10 @@ +macro_rules! print_error { + ($($arg:tt)*) => (eprintln!("[fd error]: {}", format!($($arg)*))) +} + +macro_rules! print_error_and_exit { + ($($arg:tt)*) => { + print_error!($($arg)*); + ::std::process::exit(1); + }; +} diff --git a/src/internal/mod.rs b/src/internal/mod.rs index 90c421a..d6b8026 100644 --- a/src/internal/mod.rs +++ b/src/internal/mod.rs @@ -4,17 +4,6 @@ use std::ffi::{OsStr, OsString}; use regex_syntax::hir::Hir; use regex_syntax::ParserBuilder; -macro_rules! print_error { - ($($arg:tt)*) => (eprintln!("[fd error]: {}", format!($($arg)*))) -} - -macro_rules! print_error_and_exit { - ($($arg:tt)*) => { - print_error!($($arg)*); - ::std::process::exit(1); - }; -} - #[cfg(any(unix, target_os = "redox"))] pub fn osstr_to_bytes(input: &OsStr) -> Cow<[u8]> { use std::os::unix::ffi::OsStrExt; diff --git a/src/main.rs b/src/main.rs index 2d97180..95fd0a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ #[macro_use] -mod internal; +mod error; mod app; mod exec; @@ -7,6 +7,7 @@ mod exit_codes; mod filetypes; mod filter; mod fshelper; +mod internal; mod options; mod output; mod walk;