From b423bf7ddd5f0371e2ebedb6c1c93b0ade508862 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 16 Jul 2023 12:48:01 -0700 Subject: [PATCH] Update toml to 0.7.6 --- Cargo.lock | 73 +++++++++++++++++++++++++++++++++++++++++++++--- Cargo.toml | 2 +- src/book/init.rs | 9 +++--- 3 files changed, 74 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 021ae29757..9de720c809 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -371,6 +371,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.2.8" @@ -567,7 +573,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -594,6 +600,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "headers" version = "0.3.8" @@ -769,7 +781,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", ] [[package]] @@ -1527,6 +1549,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1813,11 +1844,36 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.11" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" dependencies = [ "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] [[package]] @@ -2231,6 +2287,15 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "winnow" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" +dependencies = [ + "memchr", +] + [[package]] name = "xml5ever" version = "0.17.0" diff --git a/Cargo.toml b/Cargo.toml index 17fd11741e..9999f2afe7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ serde = { version = "1.0.163", features = ["derive"] } serde_json = "1.0.96" shlex = "1.1.0" tempfile = "3.4.0" -toml = "0.5.11" +toml = "0.7.6" topological-sort = "0.2.2" # Watch feature diff --git a/src/book/init.rs b/src/book/init.rs index faca1d09aa..1e3a00362d 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -99,12 +99,11 @@ impl BookBuilder { fn write_book_toml(&self) -> Result<()> { debug!("Writing book.toml"); let book_toml = self.root.join("book.toml"); - let cfg = toml::to_vec(&self.config).with_context(|| "Unable to serialize the config")?; + let cfg = + toml::to_string(&self.config).with_context(|| "Unable to serialize the config")?; - File::create(book_toml) - .with_context(|| "Couldn't create book.toml")? - .write_all(&cfg) - .with_context(|| "Unable to write config to book.toml")?; + fs::write(&book_toml, cfg) + .with_context(|| format!("failed to write {}", book_toml.display()))?; Ok(()) }