Skip to content

Commit

Permalink
Rename stuff for clarity
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
infinity0 committed Mar 15, 2018
1 parent 0bf8e54 commit ce26ddf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/cargo/ops/cargo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -719,7 +721,7 @@ fn generate_targets<'a>(
} else {
&profiles.test_deps
};
generate_auto_targets(
generate_default_targets(
mode,
pkg.targets(),
profile,
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit ce26ddf

Please sign in to comment.