summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-03-26 17:49:05 +0100
committermo8it <mo8it@proton.me>2024-03-26 17:49:05 +0100
commited0fcf8e3d05f5420b55370d4ff4ad8e0ded127b (patch)
tree3ae29aa5a23093494b8116e9cacf3a1446d28adb /src
parentf36efae25deee03cb6f98ce7fc1e59efb7e72985 (diff)
Formatting
Diffstat (limited to 'src')
-rw-r--r--src/main.rs7
-rw-r--r--src/verify.rs32
2 files changed, 17 insertions, 22 deletions
diff --git a/src/main.rs b/src/main.rs
index a06f0c5..a0b3af2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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}");
diff --git a/src/verify.rs b/src/verify.rs
index aee2afa..3123e45 100644
--- a/src/verify.rs
+++ b/src/verify.rs
@@ -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,
);
}