mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-21 16:41:01 -05:00
style: Make clippy happy
This commit is contained in:
parent
063ac6d4b5
commit
267121b5d6
12 changed files with 48 additions and 56 deletions
|
@ -13,8 +13,7 @@ pub fn generate_map<'d, W: std::io::Write, V: std::fmt::Display>(
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
"pub static {}: dictgen::DictTable<{}> = dictgen::DictTable {{",
|
"pub static {name}: dictgen::DictTable<{value_type}> = dictgen::DictTable {{"
|
||||||
name, value_type
|
|
||||||
)?;
|
)?;
|
||||||
writeln!(file, " keys: &[")?;
|
writeln!(file, " keys: &[")?;
|
||||||
for (key, _value) in data.iter() {
|
for (key, _value) in data.iter() {
|
||||||
|
@ -22,12 +21,12 @@ pub fn generate_map<'d, W: std::io::Write, V: std::fmt::Display>(
|
||||||
largest = std::cmp::max(largest, key.len());
|
largest = std::cmp::max(largest, key.len());
|
||||||
|
|
||||||
let key = if key.is_ascii() {
|
let key = if key.is_ascii() {
|
||||||
format!("dictgen::InsensitiveStr::Ascii({:?})", key)
|
format!("dictgen::InsensitiveStr::Ascii({key:?})")
|
||||||
} else {
|
} else {
|
||||||
format!("dictgen::InsensitiveStr::Unicode({:?})", key)
|
format!("dictgen::InsensitiveStr::Unicode({key:?})")
|
||||||
};
|
};
|
||||||
|
|
||||||
writeln!(file, " {},", key)?;
|
writeln!(file, " {key},")?;
|
||||||
}
|
}
|
||||||
if largest == 0 {
|
if largest == 0 {
|
||||||
smallest = 0;
|
smallest = 0;
|
||||||
|
@ -35,10 +34,10 @@ pub fn generate_map<'d, W: std::io::Write, V: std::fmt::Display>(
|
||||||
writeln!(file, " ],")?;
|
writeln!(file, " ],")?;
|
||||||
writeln!(file, " values: &[")?;
|
writeln!(file, " values: &[")?;
|
||||||
for (_key, value) in data.iter() {
|
for (_key, value) in data.iter() {
|
||||||
writeln!(file, " {},", value)?;
|
writeln!(file, " {value},")?;
|
||||||
}
|
}
|
||||||
writeln!(file, " ],")?;
|
writeln!(file, " ],")?;
|
||||||
writeln!(file, " range: {}..={},", smallest, largest)?;
|
writeln!(file, " range: {smallest}..={largest},")?;
|
||||||
writeln!(file, "}};")?;
|
writeln!(file, "}};")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -13,8 +13,7 @@ pub fn generate_table<'d, W: std::io::Write, V: std::fmt::Display>(
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
"pub static {}: dictgen::DictTable<{}> = dictgen::DictTable {{",
|
"pub static {name}: dictgen::DictTable<{value_type}> = dictgen::DictTable {{"
|
||||||
name, value_type
|
|
||||||
)?;
|
)?;
|
||||||
writeln!(file, " keys: &[")?;
|
writeln!(file, " keys: &[")?;
|
||||||
for (key, _value) in data.iter() {
|
for (key, _value) in data.iter() {
|
||||||
|
@ -22,12 +21,12 @@ pub fn generate_table<'d, W: std::io::Write, V: std::fmt::Display>(
|
||||||
largest = std::cmp::max(largest, key.len());
|
largest = std::cmp::max(largest, key.len());
|
||||||
|
|
||||||
let key = if key.is_ascii() {
|
let key = if key.is_ascii() {
|
||||||
format!("dictgen::InsensitiveStr::Ascii({:?})", key)
|
format!("dictgen::InsensitiveStr::Ascii({key:?})")
|
||||||
} else {
|
} else {
|
||||||
format!("dictgen::InsensitiveStr::Unicode({:?})", key)
|
format!("dictgen::InsensitiveStr::Unicode({key:?})")
|
||||||
};
|
};
|
||||||
|
|
||||||
writeln!(file, " {},", key)?;
|
writeln!(file, " {key},")?;
|
||||||
}
|
}
|
||||||
if largest == 0 {
|
if largest == 0 {
|
||||||
smallest = 0;
|
smallest = 0;
|
||||||
|
@ -35,10 +34,10 @@ pub fn generate_table<'d, W: std::io::Write, V: std::fmt::Display>(
|
||||||
writeln!(file, " ],")?;
|
writeln!(file, " ],")?;
|
||||||
writeln!(file, " values: &[")?;
|
writeln!(file, " values: &[")?;
|
||||||
for (_key, value) in data.iter() {
|
for (_key, value) in data.iter() {
|
||||||
writeln!(file, " {},", value)?;
|
writeln!(file, " {value},")?;
|
||||||
}
|
}
|
||||||
writeln!(file, " ],")?;
|
writeln!(file, " ],")?;
|
||||||
writeln!(file, " range: {}..={},", smallest, largest)?;
|
writeln!(file, " range: {smallest}..={largest},")?;
|
||||||
writeln!(file, "}};")?;
|
writeln!(file, "}};")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -86,12 +86,11 @@ mod codegen {
|
||||||
let mut root = DynRoot::new(data);
|
let mut root = DynRoot::new(data);
|
||||||
root.burst(limit);
|
root.burst(limit);
|
||||||
|
|
||||||
let unicode_table_name = format!("{}_UNICODE_TABLE", prefix);
|
let unicode_table_name = format!("{prefix}_UNICODE_TABLE");
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
"pub static {}_TRIE: dictgen::DictTrie<{}> = dictgen::DictTrie {{",
|
"pub static {prefix}_TRIE: dictgen::DictTrie<{value_type}> = dictgen::DictTrie {{"
|
||||||
prefix, value_type
|
|
||||||
)?;
|
)?;
|
||||||
writeln!(file, " root: &{},", gen_node_name(prefix, ""))?;
|
writeln!(file, " root: &{},", gen_node_name(prefix, ""))?;
|
||||||
writeln!(file, " unicode: &{},", &unicode_table_name)?;
|
writeln!(file, " unicode: &{},", &unicode_table_name)?;
|
||||||
|
@ -118,8 +117,7 @@ mod codegen {
|
||||||
let children_name = gen_children_name(prefix, &start);
|
let children_name = gen_children_name(prefix, &start);
|
||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
"static {}: dictgen::DictTrieNode<{}> = dictgen::DictTrieNode {{",
|
"static {node_name}: dictgen::DictTrieNode<{value_type}> = dictgen::DictTrieNode {{"
|
||||||
node_name, value_type
|
|
||||||
)?;
|
)?;
|
||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
|
@ -128,7 +126,7 @@ mod codegen {
|
||||||
children_name
|
children_name
|
||||||
)?;
|
)?;
|
||||||
if let Some(value) = node.value.as_ref() {
|
if let Some(value) = node.value.as_ref() {
|
||||||
writeln!(file, " value: Some({}),", value)?;
|
writeln!(file, " value: Some({value}),")?;
|
||||||
} else {
|
} else {
|
||||||
writeln!(file, " value: None,")?;
|
writeln!(file, " value: None,")?;
|
||||||
}
|
}
|
||||||
|
@ -139,13 +137,12 @@ mod codegen {
|
||||||
DynChild::Nested(n) => {
|
DynChild::Nested(n) => {
|
||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
"static {}: [Option<&dictgen::DictTrieNode<{}>>; 26] = [",
|
"static {children_name}: [Option<&dictgen::DictTrieNode<{value_type}>>; 26] = [",
|
||||||
children_name, value_type,
|
|
||||||
)?;
|
)?;
|
||||||
for b in b'a'..=b'z' {
|
for b in b'a'..=b'z' {
|
||||||
if let Some(child) = n.get(&b) {
|
if let Some(child) = n.get(&b) {
|
||||||
let c = b as char;
|
let c = b as char;
|
||||||
let next_start = format!("{}{}", start, c);
|
let next_start = format!("{start}{c}");
|
||||||
writeln!(file, " Some(&{}),", gen_node_name(prefix, &next_start))?;
|
writeln!(file, " Some(&{}),", gen_node_name(prefix, &next_start))?;
|
||||||
nodes.push((next_start, child));
|
nodes.push((next_start, child));
|
||||||
} else {
|
} else {
|
||||||
|
@ -171,21 +168,21 @@ mod codegen {
|
||||||
|
|
||||||
fn gen_node_name(prefix: &str, start: &str) -> String {
|
fn gen_node_name(prefix: &str, start: &str) -> String {
|
||||||
if start.is_empty() {
|
if start.is_empty() {
|
||||||
format!("{}_NODE", prefix)
|
format!("{prefix}_NODE")
|
||||||
} else {
|
} else {
|
||||||
let mut start = start.to_owned();
|
let mut start = start.to_owned();
|
||||||
start.make_ascii_uppercase();
|
start.make_ascii_uppercase();
|
||||||
format!("{}_{}_NODE", prefix, start)
|
format!("{prefix}_{start}_NODE")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gen_children_name(prefix: &str, start: &str) -> String {
|
fn gen_children_name(prefix: &str, start: &str) -> String {
|
||||||
if start.is_empty() {
|
if start.is_empty() {
|
||||||
format!("{}_CHILDREN", prefix)
|
format!("{prefix}_CHILDREN")
|
||||||
} else {
|
} else {
|
||||||
let mut start = start.to_owned();
|
let mut start = start.to_owned();
|
||||||
start.make_ascii_uppercase();
|
start.make_ascii_uppercase();
|
||||||
format!("{}_{}_CHILDREN", prefix, start)
|
format!("{prefix}_{start}_CHILDREN")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +209,7 @@ mod codegen {
|
||||||
let mut empty = None;
|
let mut empty = None;
|
||||||
for (key, value) in data {
|
for (key, value) in data {
|
||||||
if existing.contains(key) {
|
if existing.contains(key) {
|
||||||
panic!("Duplicate present: {}", key);
|
panic!("Duplicate present: {key}");
|
||||||
}
|
}
|
||||||
existing.insert(key);
|
existing.insert(key);
|
||||||
|
|
||||||
|
|
|
@ -89,13 +89,13 @@ fn parse_dict(raw: &str) -> Words<'_> {
|
||||||
vec![captures.get(2).unwrap().as_str()],
|
vec![captures.get(2).unwrap().as_str()],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
eprintln!("Unknown line: {}", line);
|
eprintln!("Unknown line: {line}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !bad.is_empty() {
|
if !bad.is_empty() {
|
||||||
panic!("Failed parsing; found extra words: {:#?}", bad);
|
panic!("Failed parsing; found extra words: {bad:#?}");
|
||||||
}
|
}
|
||||||
|
|
||||||
Words {
|
Words {
|
||||||
|
|
|
@ -244,7 +244,7 @@ fn run_checks(args: &args::Args) -> proc_exit::ExitResult {
|
||||||
let mut overrides = ignore::overrides::OverrideBuilder::new(".");
|
let mut overrides = ignore::overrides::OverrideBuilder::new(".");
|
||||||
for pattern in walk_policy.extend_exclude.iter() {
|
for pattern in walk_policy.extend_exclude.iter() {
|
||||||
overrides
|
overrides
|
||||||
.add(&format!("!{}", pattern))
|
.add(&format!("!{pattern}"))
|
||||||
.with_code(proc_exit::sysexits::CONFIG_ERR)?;
|
.with_code(proc_exit::sysexits::CONFIG_ERR)?;
|
||||||
}
|
}
|
||||||
let overrides = overrides
|
let overrides = overrides
|
||||||
|
|
|
@ -153,7 +153,7 @@ fn print_brief_correction(msg: &Typo<'_>) -> Result<(), std::io::Error> {
|
||||||
context_display(&msg.context),
|
context_display(&msg.context),
|
||||||
msg.typo,
|
msg.typo,
|
||||||
itertools::join(
|
itertools::join(
|
||||||
corrections.iter().map(|s| format!("`{good}{}{reset}`", s)),
|
corrections.iter().map(|s| format!("`{good}{s}{reset}`")),
|
||||||
", "
|
", "
|
||||||
)
|
)
|
||||||
)?;
|
)?;
|
||||||
|
@ -192,7 +192,7 @@ fn print_long_correction(msg: &Typo<'_>) -> Result<(), std::io::Error> {
|
||||||
"{error}error{reset}: `{error}{}{reset}` should be {}",
|
"{error}error{reset}: `{error}{}{reset}` should be {}",
|
||||||
msg.typo,
|
msg.typo,
|
||||||
itertools::join(
|
itertools::join(
|
||||||
corrections.iter().map(|s| format!("`{good}{}{reset}`", s)),
|
corrections.iter().map(|s| format!("`{good}{s}{reset}`")),
|
||||||
", "
|
", "
|
||||||
)
|
)
|
||||||
)?;
|
)?;
|
||||||
|
@ -305,7 +305,7 @@ mod tests {
|
||||||
];
|
];
|
||||||
for (i, ch) in latin_cyrillic_chars.iter().enumerate() {
|
for (i, ch) in latin_cyrillic_chars.iter().enumerate() {
|
||||||
let width = calculate_visible_column_width(ch);
|
let width = calculate_visible_column_width(ch);
|
||||||
assert_eq!(1, width, "latin_cyrillic[{}]: {}", i, ch,);
|
assert_eq!(1, width, "latin_cyrillic[{i}]: {ch}",);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ mod tests {
|
||||||
];
|
];
|
||||||
for (i, ch) in cjk_chars.iter().enumerate() {
|
for (i, ch) in cjk_chars.iter().enumerate() {
|
||||||
let width = calculate_visible_column_width(ch);
|
let width = calculate_visible_column_width(ch);
|
||||||
assert_eq!(2, width, "cjk[{}]: {}", i, ch);
|
assert_eq!(2, width, "cjk[{i}]: {ch}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ mod tests {
|
||||||
];
|
];
|
||||||
for (i, ch) in simple_emojis.iter().enumerate() {
|
for (i, ch) in simple_emojis.iter().enumerate() {
|
||||||
let width = calculate_visible_column_width(ch);
|
let width = calculate_visible_column_width(ch);
|
||||||
assert_eq!(2, width, "emoji[{}]: {}", i, ch);
|
assert_eq!(2, width, "emoji[{i}]: {ch}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ mod tests {
|
||||||
];
|
];
|
||||||
for (i, ch) in zwj_sequences.iter().enumerate() {
|
for (i, ch) in zwj_sequences.iter().enumerate() {
|
||||||
let width = calculate_visible_column_width(ch);
|
let width = calculate_visible_column_width(ch);
|
||||||
assert_eq!(2, width, "zwj[{}]: {}", i, ch);
|
assert_eq!(2, width, "zwj[{i}]: {ch}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ impl FileChecker for DiffTypos {
|
||||||
let stdout = std::io::stdout();
|
let stdout = std::io::stdout();
|
||||||
let mut handle = stdout.lock();
|
let mut handle = stdout.lock();
|
||||||
for line in diff {
|
for line in diff {
|
||||||
write!(handle, "{}", line)?;
|
write!(handle, "{line}")?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ fn generate<W: std::io::Write>(file: &mut W, prefix: &str, dict: &[u8]) {
|
||||||
let key = record_fields.next().unwrap();
|
let key = record_fields.next().unwrap();
|
||||||
let value = format!(
|
let value = format!(
|
||||||
"&[{}]",
|
"&[{}]",
|
||||||
itertools::join(record_fields.map(|field| format!(r#""{}""#, field)), ", ")
|
itertools::join(record_fields.map(|field| format!(r#""{field}""#)), ", ")
|
||||||
);
|
);
|
||||||
(key, value)
|
(key, value)
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -93,13 +93,13 @@ fn process<S: Into<String>>(
|
||||||
.filter(|(typo, _)| {
|
.filter(|(typo, _)| {
|
||||||
let is_disallowed = varcon_words.contains(&UniCase::new(typo));
|
let is_disallowed = varcon_words.contains(&UniCase::new(typo));
|
||||||
if is_disallowed {
|
if is_disallowed {
|
||||||
eprintln!("{:?} is disallowed; in varcon", typo);
|
eprintln!("{typo:?} is disallowed; in varcon");
|
||||||
}
|
}
|
||||||
!is_disallowed
|
!is_disallowed
|
||||||
})
|
})
|
||||||
.filter(|(typo, _)| {
|
.filter(|(typo, _)| {
|
||||||
if let Some(reason) = allowed_words.get(typo.as_ref()) {
|
if let Some(reason) = allowed_words.get(typo.as_ref()) {
|
||||||
eprintln!("{:?} is disallowed; {}", typo, reason);
|
eprintln!("{typo:?} is disallowed; {reason}");
|
||||||
false
|
false
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
|
|
|
@ -52,9 +52,7 @@ fn generate_variations<W: Write>(file: &mut W) {
|
||||||
file,
|
file,
|
||||||
" {}",
|
" {}",
|
||||||
itertools::join(
|
itertools::join(
|
||||||
CATEGORIES
|
CATEGORIES.iter().map(|c| format!("crate::Category::{c:?}")),
|
||||||
.iter()
|
|
||||||
.map(|c| format!("crate::Category::{:?}", c)),
|
|
||||||
" | "
|
" | "
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -71,8 +69,7 @@ fn generate_variations<W: Write>(file: &mut W) {
|
||||||
for (index, category) in CATEGORIES.iter().enumerate() {
|
for (index, category) in CATEGORIES.iter().enumerate() {
|
||||||
writeln!(
|
writeln!(
|
||||||
file,
|
file,
|
||||||
" crate::Category::{:?} => options[{}],",
|
" crate::Category::{category:?} => options[{index}],"
|
||||||
category, index
|
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -108,7 +105,7 @@ fn generate_variations<W: Write>(file: &mut W) {
|
||||||
|
|
||||||
let no_invalid = entry_sets.values().all(|data| !is_always_invalid(data));
|
let no_invalid = entry_sets.values().all(|data| !is_always_invalid(data));
|
||||||
writeln!(file).unwrap();
|
writeln!(file).unwrap();
|
||||||
writeln!(file, "pub const NO_INVALID: bool = {:?};", no_invalid,).unwrap();
|
writeln!(file, "pub const NO_INVALID: bool = {no_invalid:?};",).unwrap();
|
||||||
|
|
||||||
writeln!(file).unwrap();
|
writeln!(file).unwrap();
|
||||||
for (symbol, entry) in entries.iter() {
|
for (symbol, entry) in entries.iter() {
|
||||||
|
@ -120,14 +117,14 @@ fn generate_variations<W: Write>(file: &mut W) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_entry(file: &mut impl Write, symbol: &str, entry: &varcon_core::Entry) {
|
fn generate_entry(file: &mut impl Write, symbol: &str, entry: &varcon_core::Entry) {
|
||||||
writeln!(file, "pub(crate) static {}: VariantsMap = [", symbol).unwrap();
|
writeln!(file, "pub(crate) static {symbol}: VariantsMap = [").unwrap();
|
||||||
for category in &CATEGORIES {
|
for category in &CATEGORIES {
|
||||||
let corrections = collect_correct(entry, *category);
|
let corrections = collect_correct(entry, *category);
|
||||||
let mut corrections: Vec<_> = corrections.iter().collect();
|
let mut corrections: Vec<_> = corrections.iter().collect();
|
||||||
corrections.sort_unstable();
|
corrections.sort_unstable();
|
||||||
writeln!(file, " &[").unwrap();
|
writeln!(file, " &[").unwrap();
|
||||||
for correction in &corrections {
|
for correction in &corrections {
|
||||||
writeln!(file, " {:?},", correction).unwrap();
|
writeln!(file, " {correction:?},").unwrap();
|
||||||
}
|
}
|
||||||
writeln!(file, " ],").unwrap();
|
writeln!(file, " ],").unwrap();
|
||||||
}
|
}
|
||||||
|
|
|
@ -773,20 +773,20 @@ impl<'t> Word<'t> {
|
||||||
let mut item = itr.next().ok_or_else(|| {
|
let mut item = itr.next().ok_or_else(|| {
|
||||||
std::io::Error::new(
|
std::io::Error::new(
|
||||||
std::io::ErrorKind::InvalidInput,
|
std::io::ErrorKind::InvalidInput,
|
||||||
format!("{:?} is nothing", token),
|
format!("{token:?} is nothing"),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
if item.offset != 0 {
|
if item.offset != 0 {
|
||||||
return Err(std::io::Error::new(
|
return Err(std::io::Error::new(
|
||||||
std::io::ErrorKind::InvalidInput,
|
std::io::ErrorKind::InvalidInput,
|
||||||
format!("{:?} has padding", token),
|
format!("{token:?} has padding"),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
item.offset += offset;
|
item.offset += offset;
|
||||||
if itr.next().is_some() {
|
if itr.next().is_some() {
|
||||||
return Err(std::io::Error::new(
|
return Err(std::io::Error::new(
|
||||||
std::io::ErrorKind::InvalidInput,
|
std::io::ErrorKind::InvalidInput,
|
||||||
format!("{:?} is multiple words", token),
|
format!("{token:?} is multiple words"),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
Ok(item)
|
Ok(item)
|
||||||
|
@ -1407,7 +1407,7 @@ mod test {
|
||||||
// A 31-character hexadecimal string: too short to be a hash.
|
// A 31-character hexadecimal string: too short to be a hash.
|
||||||
("D41D8CD98F00B204E9800998ECF8427", false),
|
("D41D8CD98F00B204E9800998ECF8427", false),
|
||||||
] {
|
] {
|
||||||
let input = format!("Hello {} World", hashlike);
|
let input = format!("Hello {hashlike} World");
|
||||||
let mut expected: Vec<Identifier<'_>> = vec![
|
let mut expected: Vec<Identifier<'_>> = vec![
|
||||||
Identifier::new_unchecked("Hello", Case::None, 0),
|
Identifier::new_unchecked("Hello", Case::None, 0),
|
||||||
Identifier::new_unchecked("World", Case::None, 7+hashlike.len()),
|
Identifier::new_unchecked("World", Case::None, 7+hashlike.len()),
|
||||||
|
|
|
@ -48,7 +48,7 @@ fn generate<W: std::io::Write>(file: &mut W) {
|
||||||
write!(file, " Type {{").unwrap();
|
write!(file, " Type {{").unwrap();
|
||||||
write!(file, "category: Category::{:?}, ", t.category).unwrap();
|
write!(file, "category: Category::{:?}, ", t.category).unwrap();
|
||||||
if let Some(tag) = t.tag {
|
if let Some(tag) = t.tag {
|
||||||
write!(file, "tag: Some(Tag::{:?}), ", tag).unwrap();
|
write!(file, "tag: Some(Tag::{tag:?}), ").unwrap();
|
||||||
} else {
|
} else {
|
||||||
write!(file, "tag: {:?}, ", t.tag).unwrap();
|
write!(file, "tag: {:?}, ", t.tag).unwrap();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ fn generate<W: std::io::Write>(file: &mut W) {
|
||||||
}
|
}
|
||||||
writeln!(file, " ],").unwrap();
|
writeln!(file, " ],").unwrap();
|
||||||
if let Some(pos) = entry.pos {
|
if let Some(pos) = entry.pos {
|
||||||
write!(file, " pos: Some(Pos::{:?}),", pos).unwrap();
|
write!(file, " pos: Some(Pos::{pos:?}),").unwrap();
|
||||||
} else {
|
} else {
|
||||||
write!(file, " pos: {:?},", entry.pos).unwrap();
|
write!(file, " pos: {:?},", entry.pos).unwrap();
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ fn generate<W: std::io::Write>(file: &mut W) {
|
||||||
writeln!(file, " ],").unwrap();
|
writeln!(file, " ],").unwrap();
|
||||||
writeln!(file, " notes: &[").unwrap();
|
writeln!(file, " notes: &[").unwrap();
|
||||||
for note in &cluster.notes {
|
for note in &cluster.notes {
|
||||||
writeln!(file, " {:?},", note).unwrap();
|
writeln!(file, " {note:?},").unwrap();
|
||||||
}
|
}
|
||||||
writeln!(file, " ],").unwrap();
|
writeln!(file, " ],").unwrap();
|
||||||
writeln!(file, " }},").unwrap();
|
writeln!(file, " }},").unwrap();
|
||||||
|
|
Loading…
Reference in a new issue