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

fix(add): Avoid escaping double-quotes by using string literals #14006

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ tar = { version = "0.4.40", default-features = false }
tempfile = "3.10.1"
thiserror = "1.0.59"
time = { version = "0.3.36", features = ["parsing", "formatting", "serde"] }
toml = "0.8.12"
toml_edit = { version = "0.22.12", features = ["serde"] }
toml = "0.8.14"
toml_edit = { version = "0.22.14", features = ["serde"] }
tracing = "0.1.40" # be compatible with rustc_log: https://github.com/rust-lang/rust/blob/e51e98dde6a/compiler/rustc_log/Cargo.toml#L9
tracing-chrome = "0.7.2"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
Expand Down
8 changes: 4 additions & 4 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2922,16 +2922,16 @@ fn bad_target_cfg() {
.with_stderr(
"\
[ERROR] error in [..]/foo/.cargo/config.toml: \
could not load config key `target.\"cfg(not(target_os = \\\"none\\\"))\".runner`
could not load config key `target.'cfg(not(target_os = \"none\"))'.runner`

Caused by:
error in [..]/foo/.cargo/config.toml: \
could not load config key `target.\"cfg(not(target_os = \\\"none\\\"))\".runner`
could not load config key `target.'cfg(not(target_os = \"none\"))'.runner`

Caused by:
invalid configuration for key `target.\"cfg(not(target_os = \\\"none\\\"))\".runner`
invalid configuration for key `target.'cfg(not(target_os = \"none\"))'.runner`
expected a string or array of strings, but found a boolean for \
`target.\"cfg(not(target_os = \\\"none\\\"))\".runner` in [..]/foo/.cargo/config.toml
`target.'cfg(not(target_os = \"none\"))'.runner` in [..]/foo/.cargo/config.toml
",
)
.run();
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_add/target_cfg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn case() {

snapbox::cmd::Command::cargo_ui()
.arg("add")
.arg_line("my-package1 my-package2 --target cfg(unix)")
.arg_line("my-package1 my-package2 --target 'cfg(target_os=\"linux\")'")
.current_dir(cwd)
.assert()
.success()
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_add/target_cfg/out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ name = "cargo-list-test-fixture"
version = "0.0.0"
edition = "2015"

[target."cfg(unix)".dependencies]
[target.'cfg(target_os="linux")'.dependencies]
my-package1 = "99999.0.0"
my-package2 = "99999.0.0"
6 changes: 3 additions & 3 deletions tests/testsuite/cargo_add/target_cfg/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/testsuite/cargo_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ build.rustflags = [\"--flag-global\", \"--flag-directory\"]
extra-table.somekey = \"somevalue\"
profile.dev.opt-level = 3
profile.dev.package.foo.opt-level = 1
target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\"
target.'cfg(target_os = \"linux\")'.runner = \"runme\"
# The following environment variables may affect the loaded values.
# CARGO_ALIAS_BAR=[..]cat dog[..]
# CARGO_BUILD_JOBS=100
Expand Down Expand Up @@ -265,7 +265,7 @@ build.rustflags = [
extra-table.somekey = \"somevalue\" # [ROOT]/home/.cargo/config.toml
profile.dev.opt-level = 3 # [ROOT]/home/.cargo/config.toml
profile.dev.package.foo.opt-level = 1 # [ROOT]/home/.cargo/config.toml
target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\" # [ROOT]/home/.cargo/config.toml
target.'cfg(target_os = \"linux\")'.runner = \"runme\" # [ROOT]/home/.cargo/config.toml
# The following environment variables may affect the loaded values.
# CARGO_HOME=[ROOT]/home/.cargo
",
Expand Down Expand Up @@ -361,7 +361,7 @@ build.rustflags = [\"--flag-global\"]
extra-table.somekey = \"somevalue\"
profile.dev.opt-level = 3
profile.dev.package.foo.opt-level = 1
target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\"
target.'cfg(target_os = \"linux\")'.runner = \"runme\"

",
)
Expand Down Expand Up @@ -513,7 +513,7 @@ build.rustflags = [\"--flag-global\"]
extra-table.somekey = \"somevalue\"
profile.dev.opt-level = 3
profile.dev.package.foo.opt-level = 1
target.\"cfg(target_os = \\\"linux\\\")\".runner = \"runme\"
target.'cfg(target_os = \"linux\")'.runner = \"runme\"

",
)
Expand Down