1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-12-02 09:12:01 +02:00

Remove ui.rs

This commit is contained in:
mo8it 2024-04-05 00:49:22 +02:00
parent 5a233398eb
commit 157fe016e5
4 changed files with 6 additions and 35 deletions

View File

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

View File

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

View File

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

View File

@ -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()? {