mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 15:26:29 +00:00
Formatting
This commit is contained in:
parent
f36efae25d
commit
ed0fcf8e3d
2 changed files with 17 additions and 22 deletions
|
@ -223,10 +223,7 @@ fn main() {
|
|||
|
||||
Subcommands::Watch { success_hints } => match watch(&exercises, verbose, success_hints) {
|
||||
Err(e) => {
|
||||
println!(
|
||||
"Error: Could not watch your progress. Error message was {:?}.",
|
||||
e
|
||||
);
|
||||
println!("Error: Could not watch your progress. Error message was {e:?}.");
|
||||
println!("Most likely you've run out of disk space or your 'inotify limit' has been reached.");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
@ -280,7 +277,7 @@ fn spawn_watch_shell(
|
|||
if parts.is_empty() {
|
||||
println!("no command provided");
|
||||
} else if let Err(e) = Command::new(parts[0]).args(&parts[1..]).status() {
|
||||
println!("failed to execute command `{}`: {}", cmd, e);
|
||||
println!("failed to execute command `{cmd}`: {e}");
|
||||
}
|
||||
} else {
|
||||
println!("unknown command: {input}");
|
||||
|
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue