From 83cd91ccca22e36ed94e03cc622a88ef45e6da10 Mon Sep 17 00:00:00 2001 From: mo8it Date: Mon, 25 Mar 2024 02:35:51 +0100 Subject: [PATCH] Replace toml with toml_edit --- Cargo.lock | 18 +++--------------- Cargo.toml | 2 +- src/main.rs | 6 ++++-- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3950c47..52b2725 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -536,7 +536,7 @@ dependencies = [ "regex", "serde", "serde_json", - "toml", + "toml_edit", ] [[package]] @@ -617,18 +617,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" -[[package]] -name = "toml" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - [[package]] name = "toml_datetime" version = "0.6.5" @@ -640,9 +628,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.6" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ "indexmap", "serde", diff --git a/Cargo.toml b/Cargo.toml index 218b799..2861459 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ notify-debouncer-mini = "0.4.1" regex = "1.10.3" serde_json = "1.0.114" serde = { version = "1.0.197", features = ["derive"] } -toml = "0.8.10" +toml_edit = { version = "0.22.9", default-features = false, features = ["parse", "serde"] } [[bin]] name = "rustlings" diff --git a/src/main.rs b/src/main.rs index a06f0c5..8e0029d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -107,8 +107,10 @@ fn main() { std::process::exit(1); } - let toml_str = &fs::read_to_string("info.toml").unwrap(); - let exercises = toml::from_str::(toml_str).unwrap().exercises; + let info_file = fs::read_to_string("info.toml").unwrap(); + let exercises = toml_edit::de::from_str::(&info_file) + .unwrap() + .exercises; let verbose = args.nocapture; let command = args.command.unwrap_or_else(|| {