1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-31 13:07:46 +00:00

Add semicolons to item macros

This commit is contained in:
Haitao Li 2014-12-22 10:48:23 +11:00
parent 0a64dbfe8b
commit 9b67c372b2
7 changed files with 23 additions and 23 deletions

View file

@ -17,7 +17,7 @@ macro_rules! show_error(
pipe_write!(&mut ::std::io::stderr(), "{}: error: ", ::NAME);
pipe_writeln!(&mut ::std::io::stderr(), $($args),+);
})
)
);
#[macro_export]
macro_rules! show_warning(
@ -25,7 +25,7 @@ macro_rules! show_warning(
pipe_write!(&mut ::std::io::stderr(), "{}: warning: ", ::NAME);
pipe_writeln!(&mut ::std::io::stderr(), $($args),+);
})
)
);
#[macro_export]
macro_rules! show_info(
@ -33,17 +33,17 @@ macro_rules! show_info(
pipe_write!(&mut ::std::io::stderr(), "{}: ", ::NAME);
pipe_writeln!(&mut ::std::io::stderr(), $($args),+);
})
)
);
#[macro_export]
macro_rules! eprint(
($($args:expr),+) => (pipe_write!(&mut ::std::io::stderr(), $($args),+))
)
);
#[macro_export]
macro_rules! eprintln(
($($args:expr),+) => (pipe_writeln!(&mut ::std::io::stderr(), $($args),+))
)
);
#[macro_export]
macro_rules! crash(
@ -51,14 +51,14 @@ macro_rules! crash(
show_error!($($args),+);
unsafe { ::util::libc::exit($exitcode as ::util::libc::c_int); }
})
)
);
#[macro_export]
macro_rules! exit(
($exitcode:expr) => ({
unsafe { ::util::libc::exit($exitcode); }
})
)
);
#[macro_export]
macro_rules! crash_if_err(
@ -68,7 +68,7 @@ macro_rules! crash_if_err(
Err(f) => crash!($exitcode, "{}", f.to_string())
}
)
)
);
#[macro_export]
macro_rules! return_if_err(
@ -81,7 +81,7 @@ macro_rules! return_if_err(
}
}
)
)
);
// XXX: should the pipe_* macros return an Err just to show the write failed?
@ -99,7 +99,7 @@ macro_rules! pipe_print(
}
}
)
)
);
#[macro_export]
macro_rules! pipe_println(
@ -115,7 +115,7 @@ macro_rules! pipe_println(
}
}
)
)
);
#[macro_export]
macro_rules! pipe_write(
@ -131,7 +131,7 @@ macro_rules! pipe_write(
}
}
)
)
);
#[macro_export]
macro_rules! pipe_writeln(
@ -147,7 +147,7 @@ macro_rules! pipe_writeln(
}
}
)
)
);
#[macro_export]
macro_rules! safe_write(
@ -157,7 +157,7 @@ macro_rules! safe_write(
Err(f) => panic!(f.to_string())
}
)
)
);
#[macro_export]
macro_rules! safe_writeln(
@ -167,7 +167,7 @@ macro_rules! safe_writeln(
Err(f) => panic!(f.to_string())
}
)
)
);
#[macro_export]
macro_rules! safe_unwrap(
@ -177,4 +177,4 @@ macro_rules! safe_unwrap(
Err(f) => crash!(1, "{}", f.to_string())
}
)
)
);

View file

@ -463,7 +463,7 @@ pub fn uumain(args: Vec<String>) -> int {
let matches = match getopts(args.tail(), &opts) {
Ok(m) => m,
Err(f) => {
show_error!("Invalid options\n{}", f)
show_error!("Invalid options\n{}", f);
return 1;
}
};

View file

@ -27,7 +27,7 @@ macro_rules! silent_unwrap(
Err(_) => unsafe { ::util::libc::exit(1) }
}
)
)
);
#[path = "../common/util.rs"]
mod util;
mod linebreak;

View file

@ -146,7 +146,7 @@ fn table() {
fn print_signal(signal_name_or_value: &str) {
for signal in ALL_SIGNALS.iter() {
if signal.name == signal_name_or_value || (format!("SIG{}", signal.name).as_slice()) == signal_name_or_value {
println!("{}", signal.value)
println!("{}", signal.value);
exit!(EXIT_OK as i32)
} else if signal_name_or_value == signal.value.to_string().as_slice() {
println!("{}", signal.name);

View file

@ -266,7 +266,7 @@ macro_rules! tail_impl (
$kindprint(&mut stdout, datum);
}
})
)
);
fn tail<T: Reader>(reader: &mut BufferedReader<T>, mut line_count: uint, mut byte_count: uint, beginning: bool, lines: bool, follow: bool, sleep_msec: u64) {
if lines {

View file

@ -97,7 +97,7 @@ fn print_loadavg() {
print!("\n");
}
else {
print!("load average: ")
print!("load average: ");
for n in range(0, loads) {
print!("{:.2}{}", avg[n as uint], if n == loads - 1 { "\n" }
else { ", " } );

View file

@ -17,7 +17,7 @@ macro_rules! assert_empty_stderr(
panic!(format!("stderr: {}", $cond.stderr))
}
);
)
);
struct CmdResult {
success: bool,
stderr: String,
@ -388,7 +388,7 @@ fn test_mv_backup_dir() {
assert_empty_stderr!(result);
assert_eq!(result.stdout.as_slice(),
format!("{} -> {} (backup: {}~)\n", dir_a, dir_b, dir_b).as_slice())
format!("{} -> {} (backup: {}~)\n", dir_a, dir_b, dir_b).as_slice());
assert!(result.success);
assert!(!Path::new(dir_a).is_dir());