chore(benches): Fix compilation errors

This commit is contained in:
Ed Page 2019-10-30 07:19:27 -06:00
parent b4c4bdd1c5
commit 975dab8514
4 changed files with 11 additions and 10 deletions

View file

@ -4,12 +4,12 @@ extern crate test;
#[bench] #[bench]
fn load_corrections(b: &mut test::Bencher) { fn load_corrections(b: &mut test::Bencher) {
b.iter(|| typos_dict::BuiltIn::new()); b.iter(|| typos_cli::dict::BuiltIn::new());
} }
#[bench] #[bench]
fn correct_word_hit(b: &mut test::Bencher) { fn correct_word_hit(b: &mut test::Bencher) {
let corrections = typos_dict::BuiltIn::new(); let corrections = typos_cli::dict::BuiltIn::new();
let input = typos::tokens::Word::new("successs", 0).unwrap(); let input = typos::tokens::Word::new("successs", 0).unwrap();
assert_eq!( assert_eq!(
corrections.correct_word(input), corrections.correct_word(input),
@ -20,7 +20,7 @@ fn correct_word_hit(b: &mut test::Bencher) {
#[bench] #[bench]
fn correct_word_miss(b: &mut test::Bencher) { fn correct_word_miss(b: &mut test::Bencher) {
let corrections = typos_dict::BuiltIn::new(); let corrections = typos_cli::dict::BuiltIn::new();
let input = typos::tokens::Word::new("success", 0).unwrap(); let input = typos::tokens::Word::new("success", 0).unwrap();
assert_eq!(corrections.correct_word(input), None); assert_eq!(corrections.correct_word(input), None);
b.iter(|| corrections.correct_word(input)); b.iter(|| corrections.correct_word(input));

View file

@ -28,4 +28,4 @@ fn main() {
} }
"; ";
pub const CORPUS: &str = include_str!("../typos-dict/assets/words.csv"); pub const CORPUS: &str = include_str!("../dict/typos/assets/words.csv");

View file

@ -13,7 +13,7 @@ fn check_file_empty(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::EMPTY).unwrap(); sample_path.write_str(data::EMPTY).unwrap();
let corrections = typos_dict::BuiltIn::new(); let corrections = typos_cli::dict::BuiltIn::new();
let parser = typos::tokens::Parser::new(); let parser = typos::tokens::Parser::new();
let checks = typos::checks::CheckSettings::new().build(&corrections, &parser); let checks = typos::checks::CheckSettings::new().build(&corrections, &parser);
b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent)); b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent));
@ -27,7 +27,7 @@ fn check_file_no_tokens(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::NO_TOKENS).unwrap(); sample_path.write_str(data::NO_TOKENS).unwrap();
let corrections = typos_dict::BuiltIn::new(); let corrections = typos_cli::dict::BuiltIn::new();
let parser = typos::tokens::Parser::new(); let parser = typos::tokens::Parser::new();
let checks = typos::checks::CheckSettings::new().build(&corrections, &parser); let checks = typos::checks::CheckSettings::new().build(&corrections, &parser);
b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent)); b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent));
@ -41,7 +41,7 @@ fn check_file_single_token(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::SINGLE_TOKEN).unwrap(); sample_path.write_str(data::SINGLE_TOKEN).unwrap();
let corrections = typos_dict::BuiltIn::new(); let corrections = typos_cli::dict::BuiltIn::new();
let parser = typos::tokens::Parser::new(); let parser = typos::tokens::Parser::new();
let checks = typos::checks::CheckSettings::new().build(&corrections, &parser); let checks = typos::checks::CheckSettings::new().build(&corrections, &parser);
b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent)); b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent));
@ -55,7 +55,7 @@ fn check_file_sherlock(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::SHERLOCK).unwrap(); sample_path.write_str(data::SHERLOCK).unwrap();
let corrections = typos_dict::BuiltIn::new(); let corrections = typos_cli::dict::BuiltIn::new();
let parser = typos::tokens::Parser::new(); let parser = typos::tokens::Parser::new();
let checks = typos::checks::CheckSettings::new().build(&corrections, &parser); let checks = typos::checks::CheckSettings::new().build(&corrections, &parser);
b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent)); b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent));
@ -69,7 +69,7 @@ fn check_file_code(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::CODE).unwrap(); sample_path.write_str(data::CODE).unwrap();
let corrections = typos_dict::BuiltIn::new(); let corrections = typos_cli::dict::BuiltIn::new();
let parser = typos::tokens::Parser::new(); let parser = typos::tokens::Parser::new();
let checks = typos::checks::CheckSettings::new().build(&corrections, &parser); let checks = typos::checks::CheckSettings::new().build(&corrections, &parser);
b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent)); b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent));
@ -83,7 +83,7 @@ fn check_file_corpus(b: &mut test::Bencher) {
let sample_path = temp.child("sample"); let sample_path = temp.child("sample");
sample_path.write_str(data::CORPUS).unwrap(); sample_path.write_str(data::CORPUS).unwrap();
let corrections = typos_dict::BuiltIn::new(); let corrections = typos_cli::dict::BuiltIn::new();
let parser = typos::tokens::Parser::new(); let parser = typos::tokens::Parser::new();
let checks = typos::checks::CheckSettings::new().build(&corrections, &parser); let checks = typos::checks::CheckSettings::new().build(&corrections, &parser);
b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent)); b.iter(|| checks.check_file(sample_path.path(), true, typos::report::print_silent));

1
src/lib.rs Normal file
View file

@ -0,0 +1 @@
pub mod dict;