mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-21 21:42:23 -05:00
Remove ui.rs
This commit is contained in:
parent
5a233398eb
commit
157fe016e5
4 changed files with 6 additions and 35 deletions
|
@ -17,9 +17,6 @@ use std::time::Duration;
|
|||
use std::{io, thread};
|
||||
use verify::VerifyState;
|
||||
|
||||
#[macro_use]
|
||||
mod ui;
|
||||
|
||||
mod embedded;
|
||||
mod exercise;
|
||||
mod init;
|
||||
|
|
|
@ -21,7 +21,8 @@ pub fn run(exercise: &Exercise) -> Result<()> {
|
|||
bail!("Ran {exercise} with errors");
|
||||
}
|
||||
|
||||
success!("Successfully ran {}", exercise);
|
||||
// TODO: Color
|
||||
println!("Successfully ran {exercise}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
28
src/ui.rs
28
src/ui.rs
|
@ -1,28 +0,0 @@
|
|||
macro_rules! print_emoji {
|
||||
($emoji:expr, $sign:expr, $color: ident, $fmt:literal, $ex:expr) => {{
|
||||
use console::{style, Emoji};
|
||||
use std::env;
|
||||
let formatstr = format!($fmt, $ex);
|
||||
if env::var_os("NO_EMOJI").is_some() {
|
||||
println!("{} {}", style($sign).$color(), style(formatstr).$color());
|
||||
} else {
|
||||
println!(
|
||||
"{} {}",
|
||||
style(Emoji($emoji, $sign)).$color(),
|
||||
style(formatstr).$color()
|
||||
);
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
macro_rules! warn {
|
||||
($fmt:literal, $ex:expr) => {{
|
||||
print_emoji!("⚠️ ", "!", red, $fmt, $ex);
|
||||
}};
|
||||
}
|
||||
|
||||
macro_rules! success {
|
||||
($fmt:literal, $ex:expr) => {{
|
||||
print_emoji!("✅ ", "✓", green, $fmt, $ex);
|
||||
}};
|
||||
}
|
|
@ -39,10 +39,11 @@ pub fn verify<'a>(
|
|||
}
|
||||
|
||||
println!();
|
||||
// TODO: Color
|
||||
match exercise.mode {
|
||||
Mode::Compile => success!("Successfully ran {}!", exercise),
|
||||
Mode::Test => success!("Successfully tested {}!", exercise),
|
||||
Mode::Clippy => success!("Successfully checked {}!", exercise),
|
||||
Mode::Compile => println!("Successfully ran {exercise}!"),
|
||||
Mode::Test => println!("Successfully tested {exercise}!"),
|
||||
Mode::Clippy => println!("Successfully checked {exercise}!"),
|
||||
}
|
||||
|
||||
if let State::Pending(context) = exercise.state()? {
|
||||
|
|
Loading…
Reference in a new issue