mirror of
https://github.com/crate-ci/typos.git
synced 2025-02-18 19:12:50 -05:00
style(misspell): Make contract explicit
This commit is contained in:
parent
ed004e7df9
commit
cec3ad07f1
1 changed files with 18 additions and 9 deletions
|
@ -4,13 +4,13 @@ use structopt::StructOpt;
|
||||||
|
|
||||||
pub const DICT: &str = include_str!("../../assets/words.go");
|
pub const DICT: &str = include_str!("../../assets/words.go");
|
||||||
|
|
||||||
fn parse_dict(
|
struct Words<'s> {
|
||||||
raw: &str,
|
main: HashMap<&'s str, Vec<&'s str>>,
|
||||||
) -> (
|
american: HashMap<&'s str, Vec<&'s str>>,
|
||||||
HashMap<&str, Vec<&str>>,
|
british: HashMap<&'s str, Vec<&'s str>>,
|
||||||
HashMap<&str, Vec<&str>>,
|
}
|
||||||
HashMap<&str, Vec<&str>>,
|
|
||||||
) {
|
fn parse_dict(raw: &str) -> Words {
|
||||||
let mut bad = HashMap::new();
|
let mut bad = HashMap::new();
|
||||||
let mut main = HashMap::new();
|
let mut main = HashMap::new();
|
||||||
let mut american = HashMap::new();
|
let mut american = HashMap::new();
|
||||||
|
@ -49,7 +49,12 @@ fn parse_dict(
|
||||||
if !bad.is_empty() {
|
if !bad.is_empty() {
|
||||||
panic!("Failed parsing; found extra words: {:#?}", bad);
|
panic!("Failed parsing; found extra words: {:#?}", bad);
|
||||||
}
|
}
|
||||||
(main, american, british)
|
|
||||||
|
Words {
|
||||||
|
main,
|
||||||
|
american,
|
||||||
|
british,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate<W: std::io::Write>(file: &mut W) {
|
fn generate<W: std::io::Write>(file: &mut W) {
|
||||||
|
@ -63,7 +68,11 @@ fn generate<W: std::io::Write>(file: &mut W) {
|
||||||
writeln!(file).unwrap();
|
writeln!(file).unwrap();
|
||||||
writeln!(file, "use unicase::UniCase;").unwrap();
|
writeln!(file, "use unicase::UniCase;").unwrap();
|
||||||
|
|
||||||
let (main, american, british) = parse_dict(DICT);
|
let Words {
|
||||||
|
main,
|
||||||
|
american,
|
||||||
|
british,
|
||||||
|
} = parse_dict(DICT);
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
|
|
Loading…
Add table
Reference in a new issue