From ce26ddfd68105c6685c2b03334257e36d48f3545 Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Thu, 15 Mar 2018 16:57:58 +0100 Subject: [PATCH] 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 --- src/cargo/ops/cargo_compile.rs | 8 +++++--- src/cargo/ops/cargo_run.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 9d3643653..bec0be93e 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 b79c2e114..4bd311808 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()) -- 2.30.2