chore(CI): Fighting clippy

This commit is contained in:
Ed Page 2019-06-14 14:53:34 -06:00
parent feaad8d94d
commit 905de9bd8d
4 changed files with 7 additions and 5 deletions

View file

@ -13,7 +13,7 @@ fn main() {
write!(&mut file, "use unicase::UniCase;").unwrap(); write!(&mut file, "use unicase::UniCase;").unwrap();
write!( write!(
&mut file, &mut file,
"static DICTIONARY: phf::Map<unicase::UniCase<&'static str>, &'static str> = " "pub(crate) static DICTIONARY: phf::Map<unicase::UniCase<&'static str>, &'static str> = "
) )
.unwrap(); .unwrap();
let mut builder = phf_codegen::Map::new(); let mut builder = phf_codegen::Map::new();
@ -24,7 +24,6 @@ fn main() {
for record in &records { for record in &records {
let value = format!(r#""{}""#, &record[1]); let value = format!(r#""{}""#, &record[1]);
builder.entry(unicase::UniCase(&record[0]), &value); builder.entry(unicase::UniCase(&record[0]), &value);
break;
} }
builder.build(&mut file).unwrap(); builder.build(&mut file).unwrap();
write!(&mut file, ";\n").unwrap(); write!(&mut file, ";\n").unwrap();

View file

@ -1,5 +1,4 @@
#[allow(clippy)] use unicase::UniCase;
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));
#[derive(Default)] #[derive(Default)]
pub struct Dictionary {} pub struct Dictionary {}
@ -10,7 +9,7 @@ impl Dictionary {
} }
pub fn correct_str<'s, 'w>(&'s self, word: &'w str) -> Option<&'s str> { 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> { pub fn correct_bytes<'s, 'w>(&'s self, word: &'w [u8]) -> Option<&'s str> {

3
src/dict_codegen.rs Normal file
View file

@ -0,0 +1,3 @@
#![allow(clippy::all)]
include!(concat!(env!("OUT_DIR"), "/codegen.rs"));

View file

@ -2,6 +2,7 @@
extern crate serde_derive; extern crate serde_derive;
mod dict; mod dict;
mod dict_codegen;
pub mod report; pub mod report;
pub mod tokens; pub mod tokens;