Skip to content

Commit

Permalink
refactor(checks): Make all state dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Page committed Mar 1, 2021
1 parent 1c3acd7 commit ddeee94
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 125 deletions.
20 changes: 12 additions & 8 deletions benches/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ fn bench_checks(c: &mut Criterion) {

let corrections = typos_cli::dict::BuiltIn::new(Default::default());
let parser = typos::tokens::Tokenizer::new();
let checks = typos_cli::checks::TyposSettings::new().build_files();
let settings = typos_cli::checks::CheckSettings::new();
b.iter(|| {
checks.check_file(
typos_cli::checks::FoundFiles.check_file(
sample_path.path(),
true,
&settings,
&parser,
&corrections,
&typos_cli::report::PrintSilent,
Expand All @@ -35,11 +36,12 @@ fn bench_checks(c: &mut Criterion) {

let corrections = typos_cli::dict::BuiltIn::new(Default::default());
let parser = typos::tokens::Tokenizer::new();
let checks = typos_cli::checks::TyposSettings::new().build_identifier_parser();
let settings = typos_cli::checks::CheckSettings::new();
b.iter(|| {
checks.check_file(
typos_cli::checks::Identifiers.check_file(
sample_path.path(),
true,
&settings,
&parser,
&corrections,
&typos_cli::report::PrintSilent,
Expand All @@ -55,11 +57,12 @@ fn bench_checks(c: &mut Criterion) {

let corrections = typos_cli::dict::BuiltIn::new(Default::default());
let parser = typos::tokens::Tokenizer::new();
let checks = typos_cli::checks::TyposSettings::new().build_word_parser();
let settings = typos_cli::checks::CheckSettings::new();
b.iter(|| {
checks.check_file(
typos_cli::checks::Words.check_file(
sample_path.path(),
true,
&settings,
&parser,
&corrections,
&typos_cli::report::PrintSilent,
Expand All @@ -75,11 +78,12 @@ fn bench_checks(c: &mut Criterion) {

let corrections = typos_cli::dict::BuiltIn::new(Default::default());
let parser = typos::tokens::Tokenizer::new();
let checks = typos_cli::checks::TyposSettings::new().build_typos();
let settings = typos_cli::checks::CheckSettings::new();
b.iter(|| {
checks.check_file(
typos_cli::checks::Typos.check_file(
sample_path.path(),
true,
&settings,
&parser,
&corrections,
&typos_cli::report::PrintSilent,
Expand Down
Loading

0 comments on commit ddeee94

Please sign in to comment.