From: Ximin Luo Date: Thu, 15 Mar 2018 15:57:58 +0000 (+0100) Subject: Rename stuff for clarity X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~23^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ce26ddfd68105c6685c2b03334257e36d48f3545;p=cargo.git 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 --- 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())