Skip to content

Commit

Permalink
Use new_all_targets in cargo-fix when no target selection exists
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Jan 20, 2022
1 parent 0a73f8b commit ecbaec1
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/bin/cargo/commands/fix.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::command_prelude::*;

use cargo::ops::{self, CompileFilter, FilterRule, LibRule};
use cargo::ops;

pub fn cli() -> App {
subcommand("fix")
Expand Down Expand Up @@ -76,15 +76,9 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
let mut opts =
args.compile_options(config, mode, Some(&ws), ProfileChecking::LegacyTestOnly)?;

if let CompileFilter::Default { .. } = opts.filter {
opts.filter = CompileFilter::Only {
all_targets: true,
lib: LibRule::Default,
bins: FilterRule::All,
examples: FilterRule::All,
benches: FilterRule::All,
tests: FilterRule::All,
}
if !opts.filter.is_specific() {
// cargo fix with no target selection implies `--all-targets`.
opts.filter = ops::CompileFilter::new_all_targets();
}

ops::fix(
Expand Down

0 comments on commit ecbaec1

Please sign in to comment.