diff --git a/Cargo.lock b/Cargo.lock index 5ff67a167a..0493a916e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -996,6 +996,15 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +[[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" @@ -1491,6 +1500,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1758,11 +1776,36 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.10" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" +checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6" dependencies = [ "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6a7712b49e1775fb9a7b998de6635b299237f48b404dde71704f2e0e7f37e5" +dependencies = [ + "indexmap", + "nom8", + "serde", + "serde_spanned", + "toml_datetime", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 7856e7dec0..4c9a64c7dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" shlex = "1" tempfile = "3.0" -toml = "0.5.1" +toml = "0.7.2" topological-sort = "0.2.2" # Watch feature diff --git a/src/book/init.rs b/src/book/init.rs index dd3fa8b0df..850101ccc4 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -98,7 +98,9 @@ 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")? + .into_bytes(); File::create(book_toml) .with_context(|| "Couldn't create book.toml")?