Skip to content

Commit

Permalink
Auto merge of #10349 - epage:install, r=ehuss
Browse files Browse the repository at this point in the history
fix(install): Keep v1 file formatting the same

Inspired by #10345, I looked for other cases where
`toml_edit::easy::to_string` is used (which outputs inline tables) to
see if we should switch to `to_string_pretty`.  The crates v1 file was
the only case I found.

As a side effect, we can no longer elide the empty `dev-dependencies`
table in published manifests.  This was the behavior before `toml_edit`,
so not much of a loss.
  • Loading branch information
bors committed Feb 1, 2022
2 parents a59d202 + 24defcb commit 25fcb13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cargo/ops/common_for_install_and_uninstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl CrateListingV1 {
let mut file = lock.file();
file.seek(SeekFrom::Start(0))?;
file.set_len(0)?;
let data = toml::to_string(self)?;
let data = toml::to_string_pretty(self)?;
file.write_all(data.as_bytes())?;
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ Caused by:
Caused by:
TOML parse error at line 1, column 1
|
1 | [..] = { \"foo 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)\" = [\"foo[EXE]\"] }
1 | [..]
| ^
Unexpected `[..]`
Expected key or end of input
Expand Down

0 comments on commit 25fcb13

Please sign in to comment.