style: fix clippy

This commit is contained in:
2020-08-01 16:34:48 +08:00
parent 08aa838c80
commit 71ae5e2eb2
2 changed files with 13 additions and 9 deletions

View File

@@ -23,17 +23,22 @@ use cmd_new::CommandNew;
($($arg:tt)+) => ( crate::print_wa(&format!($($arg)+)); )
}
const GREEN: &str = "\x1B[92m";
const YELLOW: &str = "\x1B[93m";
const BOLD: &str = "\x1B[1m";
const END: &str = "\x1B[0m";
#[inline]
fn print_in (msg: &str) {
println!("{b}[INFO]{e} {m}", b = "\x1B[1m", e = "\x1B[0m", m = msg);
println!("{b}[INFO]{e} {m}", b = BOLD, e = END, m = msg);
}
#[inline]
fn print_ok (msg: &str) {
println!("{g}{b}[ OK ]{e} {g}{m}{e}", g = "\x1B[92m", b = "\x1B[1m", e = "\x1B[0m", m = msg);
println!("{g}{b}[ OK ]{e} {g}{m}{e}", g = GREEN, b = BOLD, e = END, m = msg);
}
#[inline]
fn print_wa (msg: &str) {
println!("{g}{b}[WARN]{e} {g}{m}{e}", g = "\x1B[93m", b = "\x1B[1m", e = "\x1B[0m", m = msg);
println!("{g}{b}[WARN]{e} {g}{m}{e}", g = YELLOW, b = BOLD, e = END, m = msg);
}
fn main() -> CommandError {