diff --git a/benches/checks.rs b/benches/checks.rs index dcb8dc2..fbf1f42 100644 --- a/benches/checks.rs +++ b/benches/checks.rs @@ -5,7 +5,7 @@ extern crate test; mod data; use assert_fs::prelude::*; -use typos_cli::checks::Check; +use typos_cli::checks::FileChecker; fn bench_files(data: &str, b: &mut test::Bencher) { let temp = assert_fs::TempDir::new().unwrap(); diff --git a/src/checks.rs b/src/checks.rs index 3778396..36d8980 100644 --- a/src/checks.rs +++ b/src/checks.rs @@ -4,7 +4,7 @@ use crate::report; use typos::tokens; use typos::Dictionary; -pub trait Check: Send + Sync { +pub trait FileChecker: Send + Sync { fn check_file( &self, path: &std::path::Path, @@ -106,7 +106,7 @@ pub struct Typos { binary: bool, } -impl Check for Typos { +impl FileChecker for Typos { fn check_file( &self, path: &std::path::Path, @@ -168,7 +168,7 @@ pub struct FixTypos { binary: bool, } -impl Check for FixTypos { +impl FileChecker for FixTypos { fn check_file( &self, path: &std::path::Path, @@ -253,7 +253,7 @@ pub struct DiffTypos { binary: bool, } -impl Check for DiffTypos { +impl FileChecker for DiffTypos { fn check_file( &self, path: &std::path::Path, @@ -370,7 +370,7 @@ pub struct Identifiers { binary: bool, } -impl Check for Identifiers { +impl FileChecker for Identifiers { fn check_file( &self, path: &std::path::Path, @@ -424,7 +424,7 @@ pub struct Words { binary: bool, } -impl Check for Words { +impl FileChecker for Words { fn check_file( &self, path: &std::path::Path, @@ -476,7 +476,7 @@ pub struct FoundFiles { binary: bool, } -impl Check for FoundFiles { +impl FileChecker for FoundFiles { fn check_file( &self, path: &std::path::Path, @@ -613,22 +613,22 @@ fn fix_buffer(mut buffer: Vec, typos: impl Iterator Result<(), ignore::Error> { for entry in walk { - check_entry(entry, checks, parser, dictionary, reporter)?; + walk_entry(entry, checks, parser, dictionary, reporter)?; } Ok(()) } -pub fn check_path_parallel( +pub fn walk_path_parallel( walk: ignore::WalkParallel, - checks: &dyn Check, + checks: &dyn FileChecker, parser: &typos::tokens::Tokenizer, dictionary: &dyn typos::Dictionary, reporter: &dyn report::Report, @@ -636,7 +636,7 @@ pub fn check_path_parallel( let error: std::sync::Mutex> = std::sync::Mutex::new(Ok(())); walk.run(|| { Box::new(|entry: Result| { - match check_entry(entry, checks, parser, dictionary, reporter) { + match walk_entry(entry, checks, parser, dictionary, reporter) { Ok(()) => ignore::WalkState::Continue, Err(err) => { *error.lock().unwrap() = Err(err); @@ -649,9 +649,9 @@ pub fn check_path_parallel( error.into_inner().unwrap() } -fn check_entry( +fn walk_entry( entry: Result, - checks: &dyn Check, + checks: &dyn FileChecker, parser: &typos::tokens::Tokenizer, dictionary: &dyn typos::Dictionary, reporter: &dyn report::Report, diff --git a/src/main.rs b/src/main.rs index ade1fee..f5e206d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,7 +101,7 @@ fn run() -> proc_exit::ExitResult { let reporter: &dyn report::Report = &status_reporter; let (files, identifier_parser, word_parser, checks, fixer, differ); - let selected_checks: &dyn checks::Check = if args.files { + let selected_checks: &dyn checks::FileChecker = if args.files { files = settings.build_files(); &files } else if args.identifiers { @@ -122,7 +122,7 @@ fn run() -> proc_exit::ExitResult { }; if single_threaded { - checks::check_path( + checks::walk_path( walk.build(), selected_checks, &parser, @@ -130,7 +130,7 @@ fn run() -> proc_exit::ExitResult { reporter, ) } else { - checks::check_path_parallel( + checks::walk_path_parallel( walk.build_parallel(), selected_checks, &parser,