Skip to content

Commit

Permalink
Merge pull request rust-lang#2151 from ehuss/revert-toml
Browse files Browse the repository at this point in the history
Revert toml update
  • Loading branch information
ehuss authored Aug 2, 2023
2 parents ab2cb71 + fbfe887 commit a8fd603
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 74 deletions.
73 changes: 4 additions & 69 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" # Do not update, see https://github.com/rust-lang/mdBook/issues/2037
topological-sort = "0.2.2"

# Watch feature
Expand Down
9 changes: 5 additions & 4 deletions src/book/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand Down

0 comments on commit a8fd603

Please sign in to comment.