diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 9d36436532c..bec0be93e3f 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -458,7 +458,9 @@ impl CompileFilter { } } - pub fn matches(&self, target: &Target) -> bool { + // this selects targets for "cargo run". for logic to select targets for + // other subcommands, see generate_targets and generate_default_targets + pub fn target_run(&self, target: &Target) -> bool { match *self { CompileFilter::Default { .. } => true, CompileFilter::Only { @@ -497,7 +499,7 @@ struct BuildProposal<'a> { required: bool, } -fn generate_auto_targets<'a>( +fn generate_default_targets<'a>( mode: CompileMode, targets: &'a [Target], profile: &'a Profile, @@ -719,7 +721,7 @@ fn generate_targets<'a>( } else { &profiles.test_deps }; - generate_auto_targets( + generate_default_targets( mode, pkg.targets(), profile, diff --git a/src/cargo/ops/cargo_run.rs b/src/cargo/ops/cargo_run.rs index b79c2e1142e..4bd31180851 100644 --- a/src/cargo/ops/cargo_run.rs +++ b/src/cargo/ops/cargo_run.rs @@ -33,7 +33,7 @@ pub fn run( !a.is_lib() && !a.is_custom_build() && if !options.filter.is_specific() { a.is_bin() } else { - options.filter.matches(a) + options.filter.target_run(a) } }) .map(|bin| bin.name())