From 3adc4a2b79b44ced20ef46fb081dcc6e57b0c6a2 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 17 Dec 2022 22:46:47 +1100 Subject: [PATCH] Replace dep toml_edit with toml v0.5.10 in binstalk-manifests to speed up compilation and reduce bloat. Previously we switch to toml_edit because it is unmaintained, but now with it moved into toml-rs/toml as a workspace, it is now under active maintenance again, thus we switch back to it. Signed-off-by: Jiahao XU --- Cargo.lock | 38 ++----------------- crates/binstalk-manifests/Cargo.toml | 2 +- .../binstalk-manifests/src/cargo_crates_v1.rs | 12 +++--- 3 files changed, 10 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be6ee48f1..2f7e7c0f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -238,7 +238,7 @@ dependencies = [ "serde_json", "tempfile", "thiserror", - "toml_edit", + "toml", "url", ] @@ -474,16 +474,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "compact_str" version = "0.6.1" @@ -2456,35 +2446,13 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "serde", ] -[[package]] -name = "toml_datetime" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808b51e57d0ef8f71115d8f3a01e7d3750d01c79cac4b3eda910f4389fdf92fd" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1541ba70885967e662f69d31ab3aeca7b1aaecfcd58679590b893e9239c3646" -dependencies = [ - "combine", - "indexmap", - "itertools", - "serde", - "toml_datetime", -] - [[package]] name = "tower" version = "0.4.13" diff --git a/crates/binstalk-manifests/Cargo.toml b/crates/binstalk-manifests/Cargo.toml index 382b72036..c7a19dd26 100644 --- a/crates/binstalk-manifests/Cargo.toml +++ b/crates/binstalk-manifests/Cargo.toml @@ -21,7 +21,7 @@ serde = { version = "1.0.151", features = ["derive"] } serde-tuple-vec-map = "1.0.1" serde_json = "1.0.91" thiserror = "1.0.37" -toml_edit = { version = "0.15.0", features = ["easy"] } +toml = "0.5.10" url = { version = "2.3.1", features = ["serde"] } [dev-dependencies] diff --git a/crates/binstalk-manifests/src/cargo_crates_v1.rs b/crates/binstalk-manifests/src/cargo_crates_v1.rs index d1783d807..b95282201 100644 --- a/crates/binstalk-manifests/src/cargo_crates_v1.rs +++ b/crates/binstalk-manifests/src/cargo_crates_v1.rs @@ -49,7 +49,7 @@ impl CratesToml<'_> { pub fn load_from_reader(mut reader: R) -> Result { let mut vec = Vec::new(); reader.read_to_end(&mut vec)?; - Ok(toml_edit::easy::from_slice(&vec)?) + Ok(toml::from_slice(&vec)?) } pub fn load_from_path(path: impl AsRef) -> Result { @@ -76,7 +76,7 @@ impl CratesToml<'_> { } pub fn write_to_writer(&self, mut writer: W) -> Result<(), CratesTomlParseError> { - let data = toml_edit::easy::to_vec(&self)?; + let data = toml::to_vec(&self)?; writer.write_all(&data)?; Ok(()) } @@ -159,10 +159,10 @@ pub enum CratesTomlParseError { Io(#[from] io::Error), #[error(transparent)] - TomlParse(#[from] toml_edit::easy::de::Error), + TomlParse(#[from] toml::de::Error), #[error(transparent)] - TomlWrite(Box), + TomlWrite(Box), #[error(transparent)] CvsParse(Box), @@ -174,8 +174,8 @@ impl From for CratesTomlParseError { } } -impl From for CratesTomlParseError { - fn from(e: toml_edit::easy::ser::Error) -> Self { +impl From for CratesTomlParseError { + fn from(e: toml::ser::Error) -> Self { CratesTomlParseError::TomlWrite(Box::new(e)) } }