1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-06-15 00:04:58 +02:00

refactor: change from match to if for NO_EMOJI

This commit is contained in:
Matt Lebl
2021-03-20 11:52:57 -07:00
parent 8d62a99637
commit 01e7f27aa6
3 changed files with 37 additions and 40 deletions

View File

@ -3,21 +3,18 @@ macro_rules! warn {
use std::env;
use console::{style, Emoji};
let formatstr = format!($fmt, $ex);
match env::var("NO_EMOJI").is_ok() {
true => {
println!(
"{} {}",
style("!").red(),
style(formatstr).red()
);
},
false => {
println!(
"{} {}",
style(Emoji("⚠️ ", "!")).red(),
style(formatstr).red()
);
}
if env::var("NO_EMOJI").is_ok() {
println!(
"{} {}",
style("!").red(),
style(formatstr).red()
);
} else {
println!(
"{} {}",
style(Emoji("⚠️ ", "!")).red(),
style(formatstr).red()
);
}
}};
}
@ -27,21 +24,18 @@ macro_rules! success {
use std::env;
use console::{style, Emoji};
let formatstr = format!($fmt, $ex);
match env::var("NO_EMOJI").is_ok() {
true => {
println!(
"{} {}",
style("").green(),
style(formatstr).green()
);
},
false => {
println!(
"{} {}",
style(Emoji("", "")).green(),
style(formatstr).green()
);
}
if env::var("NO_EMOJI").is_ok() {
println!(
"{} {}",
style("").green(),
style(formatstr).green()
);
} else {
println!(
"{} {}",
style(Emoji("", "")).green(),
style(formatstr).green()
);
}
}};
}