From 078b20b271ddc7de917efb054af179b30a1f5f09 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:02:30 +0000 Subject: [PATCH 1/2] fix(deps): update rust crate toml to 0.8 --- Cargo.lock | 72 ++++++++++++++++++++++++++++++++++++++++++++++++------ Cargo.toml | 2 +- 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 997b43b0..285aeea2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -116,7 +116,7 @@ dependencies = [ "structopt", "textwrap", "thiserror", - "toml", + "toml 0.8.8", "ureq", "which", "windows", @@ -255,7 +255,7 @@ checksum = "e62abb876c07e4754fae5c14cafa77937841f01740637e17d78dc04352f32a5e" dependencies = [ "cc", "rustc_version", - "toml", + "toml 0.5.11", "vswhom", "winreg", ] @@ -288,6 +288,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.5" @@ -494,9 +500,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "heck" @@ -572,11 +578,11 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] @@ -1130,6 +1136,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +dependencies = [ + "serde", +] + [[package]] name = "sha2" version = "0.10.8" @@ -1326,9 +1341,43 @@ name = "toml" version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "indexmap", "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] [[package]] @@ -1657,6 +1706,15 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "winnow" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.10.1" diff --git a/Cargo.toml b/Cargo.toml index ad5f409a..5899138b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,7 +64,7 @@ serde = { version = "1.0", features = [ "derive" ] } structopt = { version = "0.3", optional = true } textwrap = { version = "0.11", features = [ "term_size" ] } thiserror = "1.0" -toml = { version = "0.5", features = [ "preserve_order" ] } +toml = { version = "0.8", features = [ "preserve_order" ] } duct = "0.13" which = "5.0" From 11a4b7bcf0912565a64d292c33d88c12729d3269 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 7 Nov 2023 14:22:59 -0300 Subject: [PATCH 2/2] fix build --- src/config/metadata.rs | 4 ++-- src/config/raw.rs | 8 ++++---- src/dot_cargo.rs | 4 ++-- src/templating/fancy.rs | 11 ++++++----- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/config/metadata.rs b/src/config/metadata.rs index 0a810453..838ed76e 100644 --- a/src/config/metadata.rs +++ b/src/config/metadata.rs @@ -46,11 +46,11 @@ impl Metadata { } let path = project_root.join("Cargo.toml"); - let bytes = fs::read(&path).map_err(|cause| Error::ReadFailed { + let toml_str = fs::read_to_string(&path).map_err(|cause| Error::ReadFailed { path: path.clone(), cause, })?; - let cargo_toml = toml::from_slice::(&bytes) + let cargo_toml = toml::from_str::(&toml_str) .map_err(|cause| Error::ParseFailed { path, cause })?; Ok(cargo_toml.package.metadata.unwrap_or_default()) } diff --git a/src/config/raw.rs b/src/config/raw.rs index 5aee0986..00186866 100644 --- a/src/config/raw.rs +++ b/src/config/raw.rs @@ -127,11 +127,11 @@ impl Raw { .map_err(LoadError::Discover)? .map(|root_dir| { let path = root_dir.join(super::file_name()); - let bytes = fs::read(&path).map_err(|cause| LoadError::Read { + let toml_str = fs::read_to_string(&path).map_err(|cause| LoadError::Read { path: path.clone(), cause, })?; - toml::from_slice::(&bytes) + toml::from_str::(&toml_str) .map(|raw| (root_dir, raw)) .map_err(|cause| LoadError::Parse { path: path.clone(), @@ -142,9 +142,9 @@ impl Raw { } pub fn write(&self, root_dir: &Path) -> Result<(), WriteError> { - let bytes = toml::to_vec(self).map_err(WriteError::Serialize)?; + let toml_str = toml::to_string(self).map_err(WriteError::Serialize)?; let path = root_dir.join(super::file_name()); log::info!("writing config to {:?}", path); - fs::write(path, bytes).map_err(WriteError::Write) + fs::write(path, toml_str).map_err(WriteError::Write) } } diff --git a/src/dot_cargo.rs b/src/dot_cargo.rs index d346b796..df476665 100644 --- a/src/dot_cargo.rs +++ b/src/dot_cargo.rs @@ -105,11 +105,11 @@ impl DotCargo { })?; } if path.is_file() { - let bytes = fs::read(&path).map_err(|cause| LoadError::ReadFailed { + let toml_str = fs::read_to_string(&path).map_err(|cause| LoadError::ReadFailed { path: path.clone(), cause, })?; - toml::from_slice(&bytes).map_err(|cause| LoadError::DeserializeFailed { path, cause }) + toml::from_str(&toml_str).map_err(|cause| LoadError::DeserializeFailed { path, cause }) } else { Ok(Self::default()) } diff --git a/src/templating/fancy.rs b/src/templating/fancy.rs index 7222f53f..143527f9 100644 --- a/src/templating/fancy.rs +++ b/src/templating/fancy.rs @@ -52,11 +52,12 @@ impl FancyPack { let path = path.as_ref(); let raw = { - let bytes = fs::read(path).map_err(|cause| FancyPackParseError::ReadFailed { - path: path.to_owned(), - cause, - })?; - toml::from_slice::(&bytes).map_err(|cause| FancyPackParseError::ParseFailed { + let toml_str = + fs::read_to_string(path).map_err(|cause| FancyPackParseError::ReadFailed { + path: path.to_owned(), + cause, + })?; + toml::from_str::(&toml_str).map_err(|cause| FancyPackParseError::ParseFailed { path: path.to_owned(), cause, })?