Skip to content

Commit b957ec8

Browse files
committed
fix(script): Don't sanitize scripts named for keywords
1 parent 5bcf4cc commit b957ec8

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/cargo/util/toml/embedded.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ pub fn sanitize_name(name: &str) -> String {
6060
let mut name = PackageName::sanitize(name, placeholder).into_inner();
6161

6262
loop {
63-
if restricted_names::is_keyword(&name) {
64-
name.push(placeholder);
65-
} else if restricted_names::is_conflicting_artifact_name(&name) {
63+
if restricted_names::is_conflicting_artifact_name(&name) {
6664
// Being an embedded manifest, we always assume it is a `[[bin]]`
6765
name.push(placeholder);
6866
} else {

tests/testsuite/script/cargo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,16 +728,16 @@ fn test_name_is_keyword() {
728728
p.cargo("-Zscript -v ./self")
729729
.masquerade_as_nightly_cargo(&["script"])
730730
.with_stdout_data(str![[r#"
731-
current_exe: [ROOT]/home/.cargo/build/[HASH]/target/debug/self-[EXE]
731+
current_exe: [ROOT]/home/.cargo/build/[HASH]/target/debug/self[EXE]
732732
arg0: [..]
733733
args: []
734734
735735
"#]])
736736
.with_stderr_data(str![[r#"
737737
[WARNING] `package.edition` is unspecified, defaulting to `2024`
738-
[COMPILING] self- v0.0.0 ([ROOT]/foo/self)
738+
[COMPILING] self v0.0.0 ([ROOT]/foo/self)
739739
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
740-
[RUNNING] `[ROOT]/home/.cargo/build/[HASH]/target/debug/self-[EXE]`
740+
[RUNNING] `[ROOT]/home/.cargo/build/[HASH]/target/debug/self[EXE]`
741741
742742
"#]])
743743
.run();

0 commit comments

Comments
 (0)