Skip to content

Commit ed0fcf8

Browse files
committed
Formatting
1 parent f36efae commit ed0fcf8

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,7 @@ fn main() {
223223

224224
Subcommands::Watch { success_hints } => match watch(&exercises, verbose, success_hints) {
225225
Err(e) => {
226-
println!(
227-
"Error: Could not watch your progress. Error message was {:?}.",
228-
e
229-
);
226+
println!("Error: Could not watch your progress. Error message was {e:?}.");
230227
println!("Most likely you've run out of disk space or your 'inotify limit' has been reached.");
231228
std::process::exit(1);
232229
}
@@ -280,7 +277,7 @@ fn spawn_watch_shell(
280277
if parts.is_empty() {
281278
println!("no command provided");
282279
} else if let Err(e) = Command::new(parts[0]).args(&parts[1..]).status() {
283-
println!("failed to execute command `{}`: {}", cmd, e);
280+
println!("failed to execute command `{cmd}`: {e}");
284281
}
285282
} else {
286283
println!("unknown command: {input}");

src/verify.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn verify<'a>(
2424
.progress_chars("#>-"),
2525
);
2626
bar.set_position(num_done as u64);
27-
bar.set_message(format!("({:.1} %)", percentage));
27+
bar.set_message(format!("({percentage:.1} %)"));
2828

2929
for exercise in exercises {
3030
let compile_result = match exercise.mode {
@@ -37,7 +37,7 @@ pub fn verify<'a>(
3737
}
3838
percentage += 100.0 / total as f32;
3939
bar.inc(1);
40-
bar.set_message(format!("({:.1} %)", percentage));
40+
bar.set_message(format!("({percentage:.1} %)"));
4141
if bar.position() == total as u64 {
4242
println!(
4343
"Progress: You completed {} / {} exercises ({:.1} %).",
@@ -191,27 +191,25 @@ fn prompt_for_completion(
191191
Mode::Test => "The code is compiling, and the tests pass!",
192192
Mode::Clippy => clippy_success_msg,
193193
};
194-
println!();
194+
195195
if no_emoji {
196-
println!("~*~ {success_msg} ~*~")
196+
println!("\n~*~ {success_msg} ~*~\n");
197197
} else {
198-
println!("🎉 🎉 {success_msg} 🎉 🎉")
198+
println!("\n🎉 🎉 {success_msg} 🎉 🎉\n");
199199
}
200-
println!();
201200

202201
if let Some(output) = prompt_output {
203-
println!("Output:");
204-
println!("{}", separator());
205-
println!("{output}");
206-
println!("{}", separator());
207-
println!();
202+
println!(
203+
"Output:\n{separator}\n{output}\n{separator}\n",
204+
separator = separator(),
205+
);
208206
}
209207
if success_hints {
210-
println!("Hints:");
211-
println!("{}", separator());
212-
println!("{}", exercise.hint);
213-
println!("{}", separator());
214-
println!();
208+
println!(
209+
"Hints:\n{separator}\n{}\n{separator}\n",
210+
exercise.hint,
211+
separator = separator(),
212+
);
215213
}
216214

217215
println!("You can keep working on this exercise,");
@@ -231,7 +229,7 @@ fn prompt_for_completion(
231229
"{:>2} {} {}",
232230
style(context_line.number).blue().bold(),
233231
style("|").blue(),
234-
formatted_line
232+
formatted_line,
235233
);
236234
}
237235

0 commit comments

Comments
 (0)