refactor: Resolve deprecations

This commit is contained in:
Ed Page 2024-05-27 22:09:20 -05:00
parent b5345d6242
commit 6f2c324a4d
15 changed files with 17 additions and 21 deletions

5
Cargo.lock generated
View file

@ -1153,14 +1153,9 @@ checksum = "f37d101fcafc8e73748fd8a1b7048f5979f93d372fd17027d7724c1643bc379b"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
"content_inspector",
"dunce",
"filetime",
"normalize-line-endings", "normalize-line-endings",
"similar", "similar",
"snapbox-macros", "snapbox-macros",
"tempfile",
"walkdir",
] ]
[[package]] [[package]]

View file

@ -25,7 +25,7 @@ unicase = "2.7"
itertools = "0.12" itertools = "0.12"
codegenrs = "3.0" codegenrs = "3.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.5.14", features = ["path"] } snapbox = "0.5.14"
typos = { path = "../typos" } typos = { path = "../typos" }
[lints] [lints]

View file

@ -7,7 +7,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq(snapbox::file!["../src/dict_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/dict_codegen.rs"].raw());
} }
#[test] #[test]
@ -31,7 +31,7 @@ fn compat() {
writeln!(content).unwrap(); writeln!(content).unwrap();
} }
snapbox::assert_eq(snapbox::file!["../assets/compatible.csv"], &content); snapbox::assert_data_eq!(content, snapbox::file!["../assets/compatible.csv"].raw());
} }
fn is_word(word: &str) -> bool { fn is_word(word: &str) -> bool {

View file

@ -24,7 +24,7 @@ itertools = "0.12"
codegenrs = "3.0" codegenrs = "3.0"
regex = "1" regex = "1"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.5.14", features = ["path"] } snapbox = "0.5.14"
[lints] [lints]
workspace = true workspace = true

View file

@ -9,7 +9,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq(snapbox::file!["../src/dict_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/dict_codegen.rs"].raw());
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {

View file

@ -88,6 +88,7 @@ pub(crate) struct StaticDictConfig {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use itertools::Itertools; use itertools::Itertools;
use snapbox::prelude::*;
use super::TYPE_SPECIFIC_DICTS; use super::TYPE_SPECIFIC_DICTS;
@ -96,7 +97,7 @@ mod tests {
let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).collect(); let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).collect();
let types_unique: Vec<_> = types.clone().into_iter().unique().collect(); let types_unique: Vec<_> = types.clone().into_iter().unique().collect();
snapbox::assert_eq(types.join("\n"), types_unique.join("\n")); snapbox::assert_data_eq!(types_unique.join("\n"), types.join("\n").raw());
} }
#[test] #[test]
@ -108,6 +109,6 @@ mod tests {
let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).collect(); let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).collect();
let types_sorted: Vec<_> = types.iter().cloned().sorted().collect(); let types_sorted: Vec<_> = types.iter().cloned().sorted().collect();
snapbox::assert_eq(types.join("\n"), types_sorted.join("\n")); snapbox::assert_data_eq!(types_sorted.join("\n"), types.join("\n").raw());
} }
} }

View file

@ -27,7 +27,7 @@ unicase = "2.7"
codegenrs = "3.0" codegenrs = "3.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
varcon = { version = "^0.7", path = "../varcon" } varcon = { version = "^0.7", path = "../varcon" }
snapbox = { version = "0.5.14", features = ["path"] } snapbox = "0.5.14"
indexmap = "2.2.6" indexmap = "2.2.6"
[lints] [lints]

View file

@ -6,7 +6,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq(snapbox::file!["../src/word_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/word_codegen.rs"].raw());
} }
fn generate<W: std::io::Write>(file: &mut W, prefix: &str, dict: &[u8]) { fn generate<W: std::io::Write>(file: &mut W, prefix: &str, dict: &[u8]) {

View file

@ -25,7 +25,7 @@ fn verify() {
drop(wtr); drop(wtr);
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
snapbox::assert_eq(snapbox::file!["../assets/words.csv"], content); snapbox::assert_data_eq!(content, snapbox::file!["../assets/words.csv"].raw());
} }
fn parse_dict(path: &str) -> Vec<(String, Vec<String>)> { fn parse_dict(path: &str) -> Vec<(String, Vec<String>)> {

View file

@ -28,7 +28,7 @@ unicase = "2.7"
codegenrs = "3.0" codegenrs = "3.0"
itertools = "0.12" itertools = "0.12"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.5.14", features = ["path"] } snapbox = "0.5.14"
[lints] [lints]
workspace = true workspace = true

View file

@ -9,7 +9,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq(snapbox::file!["../src/vars_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/vars_codegen.rs"].raw());
} }
static CATEGORIES: [varcon::Category; 4] = [ static CATEGORIES: [varcon::Category; 4] = [

View file

@ -26,7 +26,7 @@ varcon-core = { version = "^4.0", path = "../varcon-core" }
[dev-dependencies] [dev-dependencies]
codegenrs = "3.0" codegenrs = "3.0"
varcon-core = { version = "^4.0", path = "../varcon-core", features = ["parser"] } varcon-core = { version = "^4.0", path = "../varcon-core", features = ["parser"] }
snapbox = { version = "0.5.14", features = ["path"] } snapbox = "0.5.14"
[lints] [lints]
workspace = true workspace = true

View file

@ -9,7 +9,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq(snapbox::file!["../src/codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/codegen.rs"].raw());
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {

View file

@ -24,7 +24,7 @@ unicase = "2.7"
itertools = "0.12" itertools = "0.12"
codegenrs = "3.0" codegenrs = "3.0"
dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] }
snapbox = { version = "0.5.14", features = ["path"] } snapbox = "0.5.14"
[lints] [lints]
workspace = true workspace = true

View file

@ -7,7 +7,7 @@ fn codegen() {
let content = String::from_utf8(content).unwrap(); let content = String::from_utf8(content).unwrap();
let content = codegenrs::rustfmt(&content, None).unwrap(); let content = codegenrs::rustfmt(&content, None).unwrap();
snapbox::assert_eq(snapbox::file!["../src/dict_codegen.rs"], content); snapbox::assert_data_eq!(content, snapbox::file!["../src/dict_codegen.rs"].raw());
} }
fn generate<W: std::io::Write>(file: &mut W) { fn generate<W: std::io::Write>(file: &mut W) {