Skip to content

Commit

Permalink
refactor: Clarify roles
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Page committed Mar 1, 2021
1 parent 1010d2f commit e1e4ce8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub trait FileChecker: Send + Sync {
path: &std::path::Path,
explicit: bool,
settings: &CheckSettings,
parser: &tokens::Tokenizer,
tokenizer: &tokens::Tokenizer,
dictionary: &dyn Dictionary,
reporter: &dyn report::Report,
) -> Result<(), std::io::Error>;
Expand Down Expand Up @@ -614,12 +614,12 @@ pub fn walk_path(
walk: ignore::Walk,
checks: &dyn FileChecker,
settings: &CheckSettings,
parser: &typos::tokens::Tokenizer,
tokenizer: &typos::tokens::Tokenizer,
dictionary: &dyn typos::Dictionary,
reporter: &dyn report::Report,
) -> Result<(), ignore::Error> {
for entry in walk {
walk_entry(entry, checks, settings, parser, dictionary, reporter)?;
walk_entry(entry, checks, settings, tokenizer, dictionary, reporter)?;
}
Ok(())
}
Expand All @@ -628,14 +628,14 @@ pub fn walk_path_parallel(
walk: ignore::WalkParallel,
checks: &dyn FileChecker,
settings: &CheckSettings,
parser: &typos::tokens::Tokenizer,
tokenizer: &typos::tokens::Tokenizer,
dictionary: &dyn typos::Dictionary,
reporter: &dyn report::Report,
) -> Result<(), ignore::Error> {
let error: std::sync::Mutex<Result<(), ignore::Error>> = std::sync::Mutex::new(Ok(()));
walk.run(|| {
Box::new(|entry: Result<ignore::DirEntry, ignore::Error>| {
match walk_entry(entry, checks, settings, parser, dictionary, reporter) {
match walk_entry(entry, checks, settings, tokenizer, dictionary, reporter) {
Ok(()) => ignore::WalkState::Continue,
Err(err) => {
*error.lock().unwrap() = Err(err);
Expand All @@ -652,7 +652,7 @@ fn walk_entry(
entry: Result<ignore::DirEntry, ignore::Error>,
checks: &dyn FileChecker,
settings: &CheckSettings,
parser: &typos::tokens::Tokenizer,
tokenizer: &typos::tokens::Tokenizer,
dictionary: &dyn typos::Dictionary,
reporter: &dyn report::Report,
) -> Result<(), ignore::Error> {
Expand All @@ -670,7 +670,7 @@ fn walk_entry(
} else {
entry.path()
};
checks.check_file(path, explicit, settings, parser, dictionary, reporter)?;
checks.check_file(path, explicit, settings, tokenizer, dictionary, reporter)?;
}

Ok(())
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
};
let config = load_config(cwd, &args).with_code(proc_exit::Code::CONFIG_ERR)?;

let parser = typos::tokens::TokenizerBuilder::new()
let tokenizer = typos::tokens::TokenizerBuilder::new()
.ignore_hex(config.default.ignore_hex())
.leading_digits(config.default.identifier_leading_digits())
.leading_chars(config.default.identifier_leading_chars().to_owned())
Expand Down Expand Up @@ -151,7 +151,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
walk.build(),
selected_checks,
&settings,
&parser,
&tokenizer,
&dictionary,
reporter,
)
Expand All @@ -160,7 +160,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
walk.build_parallel(),
selected_checks,
&settings,
&parser,
&tokenizer,
&dictionary,
reporter,
)
Expand Down

0 comments on commit e1e4ce8

Please sign in to comment.