Skip to content

Commit a8fd603

Browse files
authored
Merge pull request #2151 from ehuss/revert-toml
Revert toml update
2 parents ab2cb71 + fbfe887 commit a8fd603

File tree

3 files changed

+10
-74
lines changed

3 files changed

+10
-74
lines changed

Cargo.lock

Lines changed: 4 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ serde = { version = "1.0.163", features = ["derive"] }
3333
serde_json = "1.0.96"
3434
shlex = "1.1.0"
3535
tempfile = "3.4.0"
36-
toml = "0.7.6"
36+
toml = "0.5.11" # Do not update, see https://github.com/rust-lang/mdBook/issues/2037
3737
topological-sort = "0.2.2"
3838

3939
# Watch feature

src/book/init.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ impl BookBuilder {
9999
fn write_book_toml(&self) -> Result<()> {
100100
debug!("Writing book.toml");
101101
let book_toml = self.root.join("book.toml");
102-
let cfg =
103-
toml::to_string(&self.config).with_context(|| "Unable to serialize the config")?;
102+
let cfg = toml::to_vec(&self.config).with_context(|| "Unable to serialize the config")?;
104103

105-
fs::write(&book_toml, cfg)
106-
.with_context(|| format!("failed to write {}", book_toml.display()))?;
104+
File::create(book_toml)
105+
.with_context(|| "Couldn't create book.toml")?
106+
.write_all(&cfg)
107+
.with_context(|| "Unable to write config to book.toml")?;
107108
Ok(())
108109
}
109110

0 commit comments

Comments
 (0)