mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix(embedded): Be consistent with existing style when sanitizing
This commit is contained in:
parent
0c14026aa8
commit
b116864d79
@ -79,7 +79,13 @@ fn write(
|
||||
.file_stem()
|
||||
.ok_or_else(|| anyhow::format_err!("no file name"))?
|
||||
.to_string_lossy();
|
||||
let separator = '_';
|
||||
let separator = if file_name.contains('_') {
|
||||
'_'
|
||||
} else {
|
||||
// Since embedded manifests only support `[[bin]]`s, prefer arrow-case as that is the
|
||||
// more common convention for CLIs
|
||||
'-'
|
||||
};
|
||||
let name = sanitize_package_name(file_name.as_ref(), separator);
|
||||
|
||||
let mut workspace_root = target_dir.to_owned();
|
||||
@ -140,7 +146,13 @@ fn expand_manifest_(script: &RawScript, config: &Config) -> CargoResult<toml::Ta
|
||||
.file_stem()
|
||||
.ok_or_else(|| anyhow::format_err!("no file name"))?
|
||||
.to_string_lossy();
|
||||
let separator = '_';
|
||||
let separator = if file_name.contains('_') {
|
||||
'_'
|
||||
} else {
|
||||
// Since embedded manifests only support `[[bin]]`s, prefer arrow-case as that is the
|
||||
// more common convention for CLIs
|
||||
'-'
|
||||
};
|
||||
let name = sanitize_package_name(file_name.as_ref(), separator);
|
||||
let bin_name = name.clone();
|
||||
package
|
||||
|
@ -426,9 +426,9 @@ args: []
|
||||
)
|
||||
.with_stderr(
|
||||
r#"[WARNING] `package.edition` is unspecifiead, defaulting to `2021`
|
||||
[COMPILING] s-h_w_c_ v0.0.0 ([ROOT]/home/.cargo/eval/target/eval/[..]/s-h_w_c_)
|
||||
[COMPILING] s-h-w-c- v0.0.0 ([ROOT]/home/.cargo/eval/target/eval/[..]/s-h-w-c-)
|
||||
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
|
||||
[RUNNING] `[ROOT]/home/.cargo/eval/target/eval/[..]/s-h_w_c_/target/debug/s-h_w_c_[EXE]`
|
||||
[RUNNING] `[ROOT]/home/.cargo/eval/target/eval/[..]/s-h-w-c-/target/debug/s-h-w-c-[EXE]`
|
||||
"#,
|
||||
)
|
||||
.run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user