Skip to content

cargo vendor suggests vendor source config in inline form instead of separate tables #10345

Closed
@weihanglo

Description

@weihanglo

Problem

This is not actually a bug but the original form is more readable IMO.

With 1.60.0-nightly:

To use vendored sources, add this to your .cargo/config.toml for this project:

source = { crates-io = { replace-with = "vendored-sources" }, vendored-sources = { directory = "vendor" } }

With 1.58.1 stable:

To use vendored sources, add this to your .cargo/config.toml for this project:

[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"

Steps

  1. cargo +nightly vendor in any crate with dependencies.
  2. Will see suggested vendor config in inline form.

Possible Solution(s)

I guess it is due to the switch to toml_edit from toml. It should output in the same form as before, though I am afraid the fix might not be too easy.

cc @epage since you're an expert of toml_edit 😆

Notes

There might be other places got this kind of bug but I haven't had a time to scan all of them.

Version

cargo 1.60.0-nightly (1c034752d 2022-01-25)
release: 1.60.0-nightly
commit-hash: 1c034752de0df744fcd7788fcbca158830b8bf85
commit-date: 2022-01-25
host: x86_64-apple-darwin
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.77.0 (sys:0.4.51+curl-7.80.0 system ssl:(SecureTransport) LibreSSL/2.8.3)
os: Mac OS 12.2.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions