diff --git a/build.rs b/build.rs index 143b5ce..6e08dc5 100644 --- a/build.rs +++ b/build.rs @@ -13,7 +13,7 @@ fn main() { write!(&mut file, "use unicase::UniCase;").unwrap(); write!( &mut file, - "static DICTIONARY: phf::Map, &'static str> = " + "pub(crate) static DICTIONARY: phf::Map, &'static str> = " ) .unwrap(); let mut builder = phf_codegen::Map::new(); @@ -24,7 +24,6 @@ fn main() { for record in &records { let value = format!(r#""{}""#, &record[1]); builder.entry(unicase::UniCase(&record[0]), &value); - break; } builder.build(&mut file).unwrap(); write!(&mut file, ";\n").unwrap(); diff --git a/src/dict.rs b/src/dict.rs index b47ef7f..bd44896 100644 --- a/src/dict.rs +++ b/src/dict.rs @@ -1,5 +1,4 @@ -#[allow(clippy)] -include!(concat!(env!("OUT_DIR"), "/codegen.rs")); +use unicase::UniCase; #[derive(Default)] pub struct Dictionary {} @@ -10,7 +9,7 @@ impl Dictionary { } pub fn correct_str<'s, 'w>(&'s self, word: &'w str) -> Option<&'s str> { - map_lookup(&DICTIONARY, word) + map_lookup(&crate::dict_codegen::DICTIONARY, word) } pub fn correct_bytes<'s, 'w>(&'s self, word: &'w [u8]) -> Option<&'s str> { diff --git a/src/dict_codegen.rs b/src/dict_codegen.rs new file mode 100644 index 0000000..e0023b1 --- /dev/null +++ b/src/dict_codegen.rs @@ -0,0 +1,3 @@ +#![allow(clippy::all)] + +include!(concat!(env!("OUT_DIR"), "/codegen.rs")); diff --git a/src/lib.rs b/src/lib.rs index d707770..3d91820 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,7 @@ extern crate serde_derive; mod dict; +mod dict_codegen; pub mod report; pub mod tokens;