From 6f2c324a4d7be44ecdfc0803fac989c66ed2957d Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 27 May 2024 22:09:20 -0500 Subject: [PATCH] refactor: Resolve deprecations --- Cargo.lock | 5 ----- crates/codespell-dict/Cargo.toml | 2 +- crates/codespell-dict/tests/codegen.rs | 4 ++-- crates/misspell-dict/Cargo.toml | 2 +- crates/misspell-dict/tests/codegen.rs | 2 +- crates/typos-cli/src/file_type_specifics.rs | 5 +++-- crates/typos-dict/Cargo.toml | 2 +- crates/typos-dict/tests/codegen.rs | 2 +- crates/typos-dict/tests/verify.rs | 2 +- crates/typos-vars/Cargo.toml | 2 +- crates/typos-vars/tests/codegen.rs | 2 +- crates/varcon/Cargo.toml | 2 +- crates/varcon/tests/codegen.rs | 2 +- crates/wikipedia-dict/Cargo.toml | 2 +- crates/wikipedia-dict/tests/codegen.rs | 2 +- 15 files changed, 17 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8efbde5..4c685c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1153,14 +1153,9 @@ checksum = "f37d101fcafc8e73748fd8a1b7048f5979f93d372fd17027d7724c1643bc379b" dependencies = [ "anstream", "anstyle", - "content_inspector", - "dunce", - "filetime", "normalize-line-endings", "similar", "snapbox-macros", - "tempfile", - "walkdir", ] [[package]] diff --git a/crates/codespell-dict/Cargo.toml b/crates/codespell-dict/Cargo.toml index b172640..69af910 100644 --- a/crates/codespell-dict/Cargo.toml +++ b/crates/codespell-dict/Cargo.toml @@ -25,7 +25,7 @@ unicase = "2.7" itertools = "0.12" codegenrs = "3.0" dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } -snapbox = { version = "0.5.14", features = ["path"] } +snapbox = "0.5.14" typos = { path = "../typos" } [lints] diff --git a/crates/codespell-dict/tests/codegen.rs b/crates/codespell-dict/tests/codegen.rs index a25b443..fb6d02e 100644 --- a/crates/codespell-dict/tests/codegen.rs +++ b/crates/codespell-dict/tests/codegen.rs @@ -7,7 +7,7 @@ fn codegen() { let content = String::from_utf8(content).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] @@ -31,7 +31,7 @@ fn compat() { 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 { diff --git a/crates/misspell-dict/Cargo.toml b/crates/misspell-dict/Cargo.toml index 66dfa31..eafdbe0 100644 --- a/crates/misspell-dict/Cargo.toml +++ b/crates/misspell-dict/Cargo.toml @@ -24,7 +24,7 @@ itertools = "0.12" codegenrs = "3.0" regex = "1" dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } -snapbox = { version = "0.5.14", features = ["path"] } +snapbox = "0.5.14" [lints] workspace = true diff --git a/crates/misspell-dict/tests/codegen.rs b/crates/misspell-dict/tests/codegen.rs index 21852fa..f9cf923 100644 --- a/crates/misspell-dict/tests/codegen.rs +++ b/crates/misspell-dict/tests/codegen.rs @@ -9,7 +9,7 @@ fn codegen() { let content = String::from_utf8(content).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(file: &mut W) { diff --git a/crates/typos-cli/src/file_type_specifics.rs b/crates/typos-cli/src/file_type_specifics.rs index 49f6df0..5e6050c 100644 --- a/crates/typos-cli/src/file_type_specifics.rs +++ b/crates/typos-cli/src/file_type_specifics.rs @@ -88,6 +88,7 @@ pub(crate) struct StaticDictConfig { #[cfg(test)] mod tests { use itertools::Itertools; + use snapbox::prelude::*; use super::TYPE_SPECIFIC_DICTS; @@ -96,7 +97,7 @@ mod tests { let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).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] @@ -108,6 +109,6 @@ mod tests { let types: Vec<_> = TYPE_SPECIFIC_DICTS.iter().map(|(typ, _)| *typ).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()); } } diff --git a/crates/typos-dict/Cargo.toml b/crates/typos-dict/Cargo.toml index 8be1bec..93157c0 100644 --- a/crates/typos-dict/Cargo.toml +++ b/crates/typos-dict/Cargo.toml @@ -27,7 +27,7 @@ unicase = "2.7" codegenrs = "3.0" dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } varcon = { version = "^0.7", path = "../varcon" } -snapbox = { version = "0.5.14", features = ["path"] } +snapbox = "0.5.14" indexmap = "2.2.6" [lints] diff --git a/crates/typos-dict/tests/codegen.rs b/crates/typos-dict/tests/codegen.rs index 78ad440..0005f2f 100644 --- a/crates/typos-dict/tests/codegen.rs +++ b/crates/typos-dict/tests/codegen.rs @@ -6,7 +6,7 @@ fn codegen() { let content = String::from_utf8(content).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(file: &mut W, prefix: &str, dict: &[u8]) { diff --git a/crates/typos-dict/tests/verify.rs b/crates/typos-dict/tests/verify.rs index 64fd15f..518f0ca 100644 --- a/crates/typos-dict/tests/verify.rs +++ b/crates/typos-dict/tests/verify.rs @@ -25,7 +25,7 @@ fn verify() { drop(wtr); 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)> { diff --git a/crates/typos-vars/Cargo.toml b/crates/typos-vars/Cargo.toml index 52b7648..a3fd189 100644 --- a/crates/typos-vars/Cargo.toml +++ b/crates/typos-vars/Cargo.toml @@ -28,7 +28,7 @@ unicase = "2.7" codegenrs = "3.0" itertools = "0.12" dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } -snapbox = { version = "0.5.14", features = ["path"] } +snapbox = "0.5.14" [lints] workspace = true diff --git a/crates/typos-vars/tests/codegen.rs b/crates/typos-vars/tests/codegen.rs index a62fe40..2ead53e 100644 --- a/crates/typos-vars/tests/codegen.rs +++ b/crates/typos-vars/tests/codegen.rs @@ -9,7 +9,7 @@ fn codegen() { let content = String::from_utf8(content).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] = [ diff --git a/crates/varcon/Cargo.toml b/crates/varcon/Cargo.toml index c72997c..29e8ff4 100644 --- a/crates/varcon/Cargo.toml +++ b/crates/varcon/Cargo.toml @@ -26,7 +26,7 @@ varcon-core = { version = "^4.0", path = "../varcon-core" } [dev-dependencies] codegenrs = "3.0" varcon-core = { version = "^4.0", path = "../varcon-core", features = ["parser"] } -snapbox = { version = "0.5.14", features = ["path"] } +snapbox = "0.5.14" [lints] workspace = true diff --git a/crates/varcon/tests/codegen.rs b/crates/varcon/tests/codegen.rs index f077a17..743cf0c 100644 --- a/crates/varcon/tests/codegen.rs +++ b/crates/varcon/tests/codegen.rs @@ -9,7 +9,7 @@ fn codegen() { let content = String::from_utf8(content).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(file: &mut W) { diff --git a/crates/wikipedia-dict/Cargo.toml b/crates/wikipedia-dict/Cargo.toml index 6fdd21c..981f43e 100644 --- a/crates/wikipedia-dict/Cargo.toml +++ b/crates/wikipedia-dict/Cargo.toml @@ -24,7 +24,7 @@ unicase = "2.7" itertools = "0.12" codegenrs = "3.0" dictgen = { version = "^0.2", path = "../dictgen", features = ["codegen"] } -snapbox = { version = "0.5.14", features = ["path"] } +snapbox = "0.5.14" [lints] workspace = true diff --git a/crates/wikipedia-dict/tests/codegen.rs b/crates/wikipedia-dict/tests/codegen.rs index bee7462..81f7f3e 100644 --- a/crates/wikipedia-dict/tests/codegen.rs +++ b/crates/wikipedia-dict/tests/codegen.rs @@ -7,7 +7,7 @@ fn codegen() { let content = String::from_utf8(content).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(file: &mut W) {