Skip to content

Commit ce26ddf

Browse files
committed
Rename stuff for clarity
- generate_{auto => default}_target since it matches on CompileFilter::Default - CompileFilter::{matches => target_run} to make it clear it only affects `cargo run` - Add a comment pointing to generate_target for other subcommands
1 parent 0bf8e54 commit ce26ddf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/cargo/ops/cargo_compile.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,9 @@ impl CompileFilter {
458458
}
459459
}
460460

461-
pub fn matches(&self, target: &Target) -> bool {
461+
// this selects targets for "cargo run". for logic to select targets for
462+
// other subcommands, see generate_targets and generate_default_targets
463+
pub fn target_run(&self, target: &Target) -> bool {
462464
match *self {
463465
CompileFilter::Default { .. } => true,
464466
CompileFilter::Only {
@@ -497,7 +499,7 @@ struct BuildProposal<'a> {
497499
required: bool,
498500
}
499501

500-
fn generate_auto_targets<'a>(
502+
fn generate_default_targets<'a>(
501503
mode: CompileMode,
502504
targets: &'a [Target],
503505
profile: &'a Profile,
@@ -719,7 +721,7 @@ fn generate_targets<'a>(
719721
} else {
720722
&profiles.test_deps
721723
};
722-
generate_auto_targets(
724+
generate_default_targets(
723725
mode,
724726
pkg.targets(),
725727
profile,

src/cargo/ops/cargo_run.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn run(
3333
!a.is_lib() && !a.is_custom_build() && if !options.filter.is_specific() {
3434
a.is_bin()
3535
} else {
36-
options.filter.matches(a)
36+
options.filter.target_run(a)
3737
}
3838
})
3939
.map(|bin| bin.name())

0 commit comments

Comments
 (0)