1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-11-08 09:09:17 +01: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

@ -17,9 +17,6 @@ use std::time::Duration;
use std::{io, thread}; use std::{io, thread};
use verify::VerifyState; use verify::VerifyState;
#[macro_use]
mod ui;
mod embedded; mod embedded;
mod exercise; mod exercise;
mod init; mod init;

@ -21,7 +21,8 @@ pub fn run(exercise: &Exercise) -> Result<()> {
bail!("Ran {exercise} with errors"); bail!("Ran {exercise} with errors");
} }
success!("Successfully ran {}", exercise); // TODO: Color
println!("Successfully ran {exercise}");
Ok(()) Ok(())
} }

@ -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!(); println!();
// TODO: Color
match exercise.mode { match exercise.mode {
Mode::Compile => success!("Successfully ran {}!", exercise), Mode::Compile => println!("Successfully ran {exercise}!"),
Mode::Test => success!("Successfully tested {}!", exercise), Mode::Test => println!("Successfully tested {exercise}!"),
Mode::Clippy => success!("Successfully checked {}!", exercise), Mode::Clippy => println!("Successfully checked {exercise}!"),
} }
if let State::Pending(context) = exercise.state()? { if let State::Pending(context) = exercise.state()? {