Formatting

This commit is contained in:
mo8it
2024-03-26 17:49:05 +01:00
parent f36efae25d
commit ed0fcf8e3d
2 changed files with 17 additions and 22 deletions

View File

@@ -24,7 +24,7 @@ pub fn verify<'a>(
.progress_chars("#>-"),
);
bar.set_position(num_done as u64);
bar.set_message(format!("({:.1} %)", percentage));
bar.set_message(format!("({percentage:.1} %)"));
for exercise in exercises {
let compile_result = match exercise.mode {
@@ -37,7 +37,7 @@ pub fn verify<'a>(
}
percentage += 100.0 / total as f32;
bar.inc(1);
bar.set_message(format!("({:.1} %)", percentage));
bar.set_message(format!("({percentage:.1} %)"));
if bar.position() == total as u64 {
println!(
"Progress: You completed {} / {} exercises ({:.1} %).",
@@ -191,27 +191,25 @@ fn prompt_for_completion(
Mode::Test => "The code is compiling, and the tests pass!",
Mode::Clippy => clippy_success_msg,
};
println!();
if no_emoji {
println!("~*~ {success_msg} ~*~")
println!("\n~*~ {success_msg} ~*~\n");
} else {
println!("🎉 🎉 {success_msg} 🎉 🎉")
println!("\n🎉 🎉 {success_msg} 🎉 🎉\n");
}
println!();
if let Some(output) = prompt_output {
println!("Output:");
println!("{}", separator());
println!("{output}");
println!("{}", separator());
println!();
println!(
"Output:\n{separator}\n{output}\n{separator}\n",
separator = separator(),
);
}
if success_hints {
println!("Hints:");
println!("{}", separator());
println!("{}", exercise.hint);
println!("{}", separator());
println!();
println!(
"Hints:\n{separator}\n{}\n{separator}\n",
exercise.hint,
separator = separator(),
);
}
println!("You can keep working on this exercise,");
@@ -231,7 +229,7 @@ fn prompt_for_completion(
"{:>2} {} {}",
style(context_line.number).blue().bold(),
style("|").blue(),
formatted_line
formatted_line,
);
}