From 4a09e85fabc9410ffd55b508bfd3fc1874c55b20 Mon Sep 17 00:00:00 2001 From: Xing Guo Date: Mon, 2 Sep 2024 22:22:53 +0800 Subject: [PATCH] Bump serde-yaml to its latest version. (#72) serde-yaml resolves https://github.com/dtolnay/serde-yaml/issues/86 in 0.9.x. This patch bumps it to the latest version to clean up legacy codes. --- Cargo.lock | 80 ++++++++++++++++++++------------------------------- Cargo.toml | 2 +- src/config.rs | 10 ++----- 3 files changed, 34 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c03d558..72ea598 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -162,12 +162,6 @@ dependencies = [ "which", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.14.3" @@ -188,22 +182,12 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.1.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown", ] [[package]] @@ -217,6 +201,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + [[package]] name = "lazy_static" version = "1.4.0" @@ -240,12 +230,6 @@ dependencies = [ "redox_syscall", ] -[[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.4.11" @@ -290,18 +274,18 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -390,18 +374,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", @@ -410,14 +394,15 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.26" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 1.9.3", + "indexmap", + "itoa", "ryu", "serde", - "yaml-rust", + "unsafe-libyaml", ] [[package]] @@ -431,9 +416,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525" dependencies = [ "proc-macro2", "quote", @@ -509,7 +494,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "indexmap 2.1.0", + "indexmap", "toml_datetime", "winnow", ] @@ -520,6 +505,12 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -642,12 +633,3 @@ checksum = "8434aeec7b290e8da5c3f0d628cb0eac6cabcb31d14bb74f779a08109a5914d6" dependencies = [ "memchr", ] - -[[package]] -name = "yaml-rust" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] diff --git a/Cargo.toml b/Cargo.toml index d317bae..aab3186 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ dirs = "4.0.*" tempfile = "3.8.*" # 1.0.98 doesn't compile under Mac serde = { version = "1.0.*", features = ["derive"] } -serde_yaml = "0.8.*" +serde_yaml = "0.9.34" toml_edit = "0.21.*" shellexpand = "2.1.*" log = "0.4.*" diff --git a/src/config.rs b/src/config.rs index ad001d3..ca3ca02 100644 --- a/src/config.rs +++ b/src/config.rs @@ -53,15 +53,10 @@ impl Default for Config { pub fn parse(path: PathBuf) -> Config { let file = std::fs::File::open(path).unwrap(); let reader = std::io::BufReader::new(file); - let mut config = match serde_yaml::from_reader(reader) { + let mut config: Config = match serde_yaml::from_reader(reader) { Ok(c) => c, Err(e) => { - // Work around the empty yaml file issue. - // See https://github.com/dtolnay/serde-yaml/issues/86 - if e.to_string() != "EOF while parsing a value" { - panic!("{}", e.to_string()) - } - Config::default() + panic!("{}", e.to_string()) } }; @@ -166,7 +161,6 @@ fonts: assert_eq!(config.term_config_path, Some("/path/to/config".to_string())); } - #[test] fn test_parse_backend_and_deprecated_exe_path() { let config = parse(make_cfg_file("backend: alacritty\nexe_path: /path/to/alacritty").path);