mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-29 04:21:06 -05:00
refactor: Collpase cases
This commit is contained in:
parent
8732d24f53
commit
2e1b95fec1
1 changed files with 20 additions and 41 deletions
51
src/main.rs
51
src/main.rs
|
@ -562,52 +562,31 @@ fn run() -> Result<i32, anyhow::Error> {
|
||||||
});
|
});
|
||||||
errors_found = atomic_errors.into_inner();
|
errors_found = atomic_errors.into_inner();
|
||||||
}
|
}
|
||||||
} else if args.identifiers {
|
|
||||||
let checks = settings.build_identifier_parser();
|
|
||||||
let (cur_typos, cur_errors) = if single_threaded {
|
|
||||||
check_path(walk.build(), &checks, &parser, &dictionary, reporter)
|
|
||||||
} else {
|
} else {
|
||||||
check_path_parallel(
|
let (identifier_parser, word_parser, checks);
|
||||||
walk.build_parallel(),
|
let selected_checks: &dyn Checks = if args.identifiers {
|
||||||
&checks,
|
identifier_parser = settings.build_identifier_parser();
|
||||||
&parser,
|
&identifier_parser
|
||||||
&dictionary,
|
|
||||||
reporter,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
if cur_typos {
|
|
||||||
typos_found = true;
|
|
||||||
}
|
|
||||||
if cur_errors {
|
|
||||||
errors_found = true;
|
|
||||||
}
|
|
||||||
} else if args.words {
|
} else if args.words {
|
||||||
let checks = settings.build_word_parser();
|
word_parser = settings.build_word_parser();
|
||||||
let (cur_typos, cur_errors) = if single_threaded {
|
&word_parser
|
||||||
check_path(walk.build(), &checks, &parser, &dictionary, reporter)
|
|
||||||
} else {
|
} else {
|
||||||
check_path_parallel(
|
checks = settings.build_checks();
|
||||||
walk.build_parallel(),
|
&checks
|
||||||
&checks,
|
};
|
||||||
|
|
||||||
|
let (cur_typos, cur_errors) = if single_threaded {
|
||||||
|
check_path(
|
||||||
|
walk.build(),
|
||||||
|
selected_checks,
|
||||||
&parser,
|
&parser,
|
||||||
&dictionary,
|
&dictionary,
|
||||||
reporter,
|
reporter,
|
||||||
)
|
)
|
||||||
};
|
|
||||||
if cur_typos {
|
|
||||||
typos_found = true;
|
|
||||||
}
|
|
||||||
if cur_errors {
|
|
||||||
errors_found = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let checks = settings.build_checks();
|
|
||||||
let (cur_typos, cur_errors) = if single_threaded {
|
|
||||||
check_path(walk.build(), &checks, &parser, &dictionary, reporter)
|
|
||||||
} else {
|
} else {
|
||||||
check_path_parallel(
|
check_path_parallel(
|
||||||
walk.build_parallel(),
|
walk.build_parallel(),
|
||||||
&checks,
|
selected_checks,
|
||||||
&parser,
|
&parser,
|
||||||
&dictionary,
|
&dictionary,
|
||||||
reporter,
|
reporter,
|
||||||
|
|
Loading…
Reference in a new issue