Skip to content

Commit

Permalink
Auto merge of #8135 - ehuss:allows-dashes, r=Eh2406
Browse files Browse the repository at this point in the history
Rename allows_underscores to allows_dashes.

I think this better reflects what it means.
  • Loading branch information
bors committed Apr 19, 2020
2 parents 235beb0 + 2a14979 commit 8e8c62b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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

0 comments on commit 8e8c62b

Please sign in to comment.