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

Rename allows_underscores to allows_dashes. #8135

Merged
merged 1 commit into from
Apr 19, 2020
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
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/context/compilation_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> {

/// Returns the bin filename for a given target, without extension and metadata.
fn bin_stem(&self, unit: &Unit<'_>) -> String {
if unit.target.allows_underscores() {
if unit.target.allows_dashes() {
unit.target.name().to_string()
} else {
unit.target.crate_name()
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ fn rustc<'a, 'cfg>(
// don't pass the `-l` flags.
let pass_l_flag = unit.target.is_lib() || !unit.pkg.targets().iter().any(|t| t.is_lib());
let pass_cdylib_link_args = unit.target.is_cdylib();
let do_rename = unit.target.allows_underscores() && !unit.mode.is_any_test();
let do_rename = unit.target.allows_dashes() && !unit.mode.is_any_test();
let real_name = unit.target.name().to_string();
let crate_name = unit.target.crate_name();

Expand Down
6 changes: 5 additions & 1 deletion src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,11 @@ impl Target {
}
}

pub fn allows_underscores(&self) -> bool {
/// Whether or not this target allows dashes in its filename.
///
/// Rustc will always emit filenames with underscores, and Cargo will
/// rename them back to dashes if this is true.
pub fn allows_dashes(&self) -> bool {
self.is_bin() || self.is_example() || self.is_custom_build()
}

Expand Down