mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 05:52:23 -05:00
Call looks_done only once
This commit is contained in:
parent
e1375ef431
commit
f205ee3d4c
1 changed files with 4 additions and 6 deletions
10
src/main.rs
10
src/main.rs
|
@ -149,17 +149,15 @@ fn main() {
|
||||||
let filter_cond = filters
|
let filter_cond = filters
|
||||||
.iter()
|
.iter()
|
||||||
.any(|f| exercise.name.contains(f) || fname.contains(f));
|
.any(|f| exercise.name.contains(f) || fname.contains(f));
|
||||||
let status = if exercise.looks_done() {
|
let looks_done = exercise.looks_done();
|
||||||
|
let status = if looks_done {
|
||||||
exercises_done += 1;
|
exercises_done += 1;
|
||||||
"Done"
|
"Done"
|
||||||
} else {
|
} else {
|
||||||
"Pending"
|
"Pending"
|
||||||
};
|
};
|
||||||
let solve_cond = {
|
let solve_cond =
|
||||||
(exercise.looks_done() && solved)
|
(looks_done && solved) || (!looks_done && unsolved) || (!solved && !unsolved);
|
||||||
|| (!exercise.looks_done() && unsolved)
|
|
||||||
|| (!solved && !unsolved)
|
|
||||||
};
|
|
||||||
if solve_cond && (filter_cond || filter.is_none()) {
|
if solve_cond && (filter_cond || filter.is_none()) {
|
||||||
let line = if paths {
|
let line = if paths {
|
||||||
format!("{fname}\n")
|
format!("{fname}\n")
|
||||||
|
|
Loading…
Reference in a new issue