Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Use single quotes for target headers #14002

Closed
fenhl opened this issue Jun 3, 2024 · 0 comments · Fixed by #14006
Closed

add: Use single quotes for target headers #14002

fenhl opened this issue Jun 3, 2024 · 0 comments · Fixed by #14006
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-add S-triage Status: This issue is waiting on initial triage.

Comments

@fenhl
Copy link
Contributor

fenhl commented Jun 3, 2024

Problem

Running cargo add with the --target option generates TOML code with double quotes, resulting in backslash-escaped double quotes in the target expression:

[target."cfg(target_os = \"linux\")".dependencies]

This is a bit difficult to read.

Proposed Solution

Use single quotes instead:

[target.'cfg(target_os = "linux")'.dependencies]

Notes

This matches the formatting used in the Platform-specific dependencies section of the Cargo book.

@fenhl fenhl added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Jun 3, 2024
epage added a commit to epage/toml_edit that referenced this issue Jun 3, 2024
epage added a commit to epage/toml_edit that referenced this issue Jun 3, 2024
bors added a commit that referenced this issue Jun 3, 2024
fix(add): Avoid escaping double-quotes by using string literals

### What does this PR try to resolve?

Fixes #14002

### How should we test and review this PR?

### Additional information
@bors bors closed this as completed in c00c5cd Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-add S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants