Skip to content

Commit

Permalink
Update doc for CompileFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Jan 20, 2022
1 parent ecbaec1 commit 2f5b303
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cargo/ops/cargo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ impl FilterRule {
}

impl CompileFilter {
/// Construct a CompileFilter from raw command line arguments.
/// Constructs a filter from raw command line arguments.
pub fn from_raw_arguments(
lib_only: bool,
bins: Vec<String>,
Expand Down Expand Up @@ -788,7 +788,7 @@ impl CompileFilter {
CompileFilter::new(rule_lib, rule_bins, rule_tsts, rule_exms, rule_bens)
}

/// Construct a CompileFilter from underlying primitives.
/// Constructs a filter from underlying primitives.
pub fn new(
rule_lib: LibRule,
rule_bins: FilterRule,
Expand Down Expand Up @@ -817,6 +817,7 @@ impl CompileFilter {
}
}

/// Constructs a filter that includes all targets.
pub fn new_all_targets() -> CompileFilter {
CompileFilter::Only {
all_targets: true,
Expand Down Expand Up @@ -872,6 +873,7 @@ impl CompileFilter {
}
}

/// Indicates if Cargo needs to build any dev dependency.
pub fn need_dev_deps(&self, mode: CompileMode) -> bool {
match mode {
CompileMode::Test | CompileMode::Doctest | CompileMode::Bench => true,
Expand All @@ -892,8 +894,8 @@ impl CompileFilter {
}
}

// this selects targets for "cargo run". for logic to select targets for
// other subcommands, see generate_targets and filter_default_targets
/// Selects targets for "cargo run". for logic to select targets for other
/// subcommands, see `generate_targets` and `filter_default_targets`.
pub fn target_run(&self, target: &Target) -> bool {
match *self {
CompileFilter::Default { .. } => true,
Expand Down

0 comments on commit 2f5b303

Please sign in to comment.