From d8e4940dbe11815d2a2c8dccea2be04255355c75 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 15:12:34 +0100 Subject: [PATCH] Bump toml from 0.5.11 to 0.7.0 (#933) * Bump toml from 0.5.11 to 0.7.0 Bumps [toml](https://github.com/toml-rs/toml) from 0.5.11 to 0.7.0. - [Release notes](https://github.com/toml-rs/toml/releases) - [Commits](https://github.com/toml-rs/toml/compare/toml-v0.5.11...toml-v0.7.0) --- updated-dependencies: - dependency-name: toml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Introduce new let...else syntax * Update config file loading for latest toml crate version --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Matthias Co-authored-by: Matthias Endler --- Cargo.lock | 47 +++++++++++++++++++++++++++++++++++++-- lychee-bin/Cargo.toml | 2 +- lychee-bin/src/options.rs | 4 ++-- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c2796ad..bfb03aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2208,6 +2208,15 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nom8" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" +dependencies = [ + "memchr", +] + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -3077,6 +3086,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "serde_spanned" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c68e921cef53841b8925c2abadd27c9b891d9613bdc43d6b823062866df38e8" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3510,11 +3528,36 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.11" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "2f560bc7fb3eb31f5eee1340c68a2160cad39605b7b9c9ec32045ddbdee13b85" dependencies = [ "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "886f31a9b85b6182cabd4d8b07df3b451afcc216563748201490940d2a28ed36" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233d8716cdc5d20ec88a18a839edaf545edc71efa4a5ff700ef4a102c26cd8fa" +dependencies = [ + "indexmap", + "nom8", + "serde", + "serde_spanned", + "toml_datetime", ] [[package]] diff --git a/lychee-bin/Cargo.toml b/lychee-bin/Cargo.toml index 5358c7c..8afd57a 100644 --- a/lychee-bin/Cargo.toml +++ b/lychee-bin/Cargo.toml @@ -36,8 +36,8 @@ ring = "0.16.20" serde = { version = "1.0.152", features = ["derive"] } serde_json = "1.0.91" tabled = "0.10.0" +toml = "0.7.0" tokio = { version = "1.25.0", features = ["full"] } -toml = "0.5.11" futures = "0.3.25" tokio-stream = "0.1.11" once_cell = "1.17.0" diff --git a/lychee-bin/src/options.rs b/lychee-bin/src/options.rs index 372b664..d662a59 100644 --- a/lychee-bin/src/options.rs +++ b/lychee-bin/src/options.rs @@ -342,7 +342,7 @@ impl Config { /// Load configuration from a file pub(crate) fn load_from_file(path: &str) -> Result> { // Read configuration file - let result = fs::read(path); + let result = fs::read_to_string(path); // Ignore a file-not-found error let contents = match result { @@ -355,7 +355,7 @@ impl Config { } }; - Ok(Some(toml::from_slice(&contents)?)) + Ok(Some(toml::from_str(&contents)?)) } /// Merge the configuration from TOML into the CLI configuration