From aed991f75fa5e5c2bd15d717d6e7084a0f0a6b9c Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 2 Aug 2023 08:32:44 -0700 Subject: [PATCH] Revert "Merge pull request #2125 from ehuss/update-toml" This reverts commit 89797064b85b775c1b5e2d7d4980bc18bd010df4, reversing changes made to 7824aed878aa11046ad72dc7222efd666dce48e9. --- Cargo.lock | 73 +++--------------------------------------------- Cargo.toml | 2 +- src/book/init.rs | 9 +++--- 3 files changed, 10 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ae309cd..f83df8bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -393,12 +393,6 @@ 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.1" @@ -590,7 +584,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap", "slab", "tokio", "tokio-util", @@ -617,12 +611,6 @@ 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" @@ -789,17 +777,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "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", + "hashbrown", ] [[package]] @@ -1569,15 +1547,6 @@ 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" @@ -1866,36 +1835,11 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" 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]] @@ -2317,15 +2261,6 @@ 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 74886150..7c9f329e 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.7.6" +toml = "0.5.11" topological-sort = "0.2.2" # Watch feature diff --git a/src/book/init.rs b/src/book/init.rs index 1e3a0036..faca1d09 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -99,11 +99,12 @@ impl BookBuilder { fn write_book_toml(&self) -> Result<()> { debug!("Writing book.toml"); let book_toml = self.root.join("book.toml"); - let cfg = - toml::to_string(&self.config).with_context(|| "Unable to serialize the config")?; + let cfg = toml::to_vec(&self.config).with_context(|| "Unable to serialize the config")?; - fs::write(&book_toml, cfg) - .with_context(|| format!("failed to write {}", book_toml.display()))?; + File::create(book_toml) + .with_context(|| "Couldn't create book.toml")? + .write_all(&cfg) + .with_context(|| "Unable to write config to book.toml")?; Ok(()) }