Move error macros to error.rs

This commit is contained in:
sharkdp 2020-04-03 11:41:22 +02:00 committed by David Peter
parent 65096a653e
commit a3060f952e
3 changed files with 12 additions and 12 deletions

10
src/error.rs Normal file
View file

@ -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);
};
}

View file

@ -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;

View file

@ -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;