From c4021d210902a960e8fdcdb18c8845f6919eb182 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 4 May 2024 17:05:12 -0700 Subject: [PATCH] deps: remove yaml-rust in favor of serde-yaml --- Cargo.lock | 17 +---------------- sync-color-schemes/Cargo.toml | 2 +- sync-color-schemes/src/base16.rs | 19 ++----------------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23e0965bc..ab419f77b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2965,12 +2965,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.3.8" @@ -5167,13 +5161,13 @@ dependencies = [ "rusqlite", "serde", "serde_json", + "serde_yaml", "sqlite-cache", "tar", "tempfile", "tokio", "toml 0.8.12", "wezterm-dynamic", - "yaml-rust", ] [[package]] @@ -7194,15 +7188,6 @@ version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "yasna" version = "0.5.2" diff --git a/sync-color-schemes/Cargo.toml b/sync-color-schemes/Cargo.toml index 0fbf28059..0e11baa9b 100644 --- a/sync-color-schemes/Cargo.toml +++ b/sync-color-schemes/Cargo.toml @@ -18,10 +18,10 @@ reqwest = "0.11" rusqlite = {version="0.30", features=["bundled", "blob"]} serde = {version="1.0", features=["derive"]} serde_json = "1.0" +serde_yaml = "0.9" sqlite-cache = {git="https://github.com/losfair/sqlite-cache", rev="0961b50385ff189bb12742716331c05ed0bf7805" } tar = "0.4" tempfile = "3.3" tokio = { version = "1.19", features = ["rt-multi-thread", "sync", "macros"] } toml = "0.8" wezterm-dynamic = { path = "../wezterm-dynamic" } -yaml-rust = "0.4.5" diff --git a/sync-color-schemes/src/base16.rs b/sync-color-schemes/src/base16.rs index c809363db..2ce925bb3 100644 --- a/sync-color-schemes/src/base16.rs +++ b/sync-color-schemes/src/base16.rs @@ -11,23 +11,8 @@ async fn fetch_base16_list() -> anyhow::Result> { ) .await?; - let mut result = vec![]; - for doc in yaml_rust::YamlLoader::load_from_str(&data)? { - for value in doc - .into_hash() - .ok_or_else(|| anyhow::anyhow!("list.yaml isn't a hash"))? - .values() - { - result.push( - value - .clone() - .into_string() - .ok_or_else(|| anyhow::anyhow!("item {value:?} is not a string"))?, - ); - } - } - - Ok(result) + let mapping: HashMap = serde_yaml::from_str(&data)?; + Ok(mapping.into_values().collect()) } async fn fetch_repo_tarball(repo_url: &str, branch: &str) -> anyhow::Result> {