diff --git a/src/bin/cargo/commands/fix.rs b/src/bin/cargo/commands/fix.rs index d0d7813b3..22ec06395 100644 --- a/src/bin/cargo/commands/fix.rs +++ b/src/bin/cargo/commands/fix.rs @@ -78,14 +78,6 @@ pub fn cli() -> App { .help("Get fix suggestions from clippy instead of rustc") .hidden(true), ) - .arg( - Arg::with_name("clippy-arg") - .long("clippy-arg") - .help("Args to pass through to clippy, implies --clippy") - .hidden(true) - .multiple(true) - .number_of_values(1), - ) .after_help( "\ This Cargo subcommand will automatically take rustc's suggestions from @@ -139,7 +131,11 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult { // code as we can. let mut opts = args.compile_options(config, mode, Some(&ws))?; - let clippy_args = args.values_of_lossy("clippy-args"); + let clippy_args = args + .value_of("clippy") // always yields None + .map(|s| s.split(' ').map(|s| s.to_string()).collect()) + .or_else(|| Some(vec![])); + let use_clippy = args.is_present("clippy") || clippy_args.is_some(); if use_clippy && !config.cli_unstable().unstable_options { @@ -171,7 +167,6 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult { allow_no_vcs: args.is_present("allow-no-vcs"), allow_staged: args.is_present("allow-staged"), broken_code: args.is_present("broken-code"), - use_clippy, clippy_args, }, )?; diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index a4eea73ae..e31a2caae 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -1790,6 +1790,6 @@ impl Drop for PackageCacheLock<'_> { /// Allows override of the path via `CARGO_CLIPPY_DRIVER` env variable pub fn clippy_driver() -> PathBuf { env::var("CARGO_CLIPPY_DRIVER") - .unwrap_or_else(|_| "clippy_driver".into()) + .unwrap_or_else(|_| "clippy-driver".into()) .into() } diff --git a/tests/testsuite/clippy.rs b/tests/testsuite/clippy.rs index 9e0879668..9bc7e1710 100644 --- a/tests/testsuite/clippy.rs +++ b/tests/testsuite/clippy.rs @@ -1,4 +1,4 @@ -use crate::support::{clippy_is_available, is_nightly, process, project}; +use crate::support::{clippy_is_available, is_nightly, project}; #[cargo_test] fn clippy() { diff --git a/tests/testsuite/fix.rs b/tests/testsuite/fix.rs index a475494c9..9ecca5e45 100644 --- a/tests/testsuite/fix.rs +++ b/tests/testsuite/fix.rs @@ -3,7 +3,7 @@ use std::fs::File; use git2; use crate::support::git; -use crate::support::{basic_manifest, project}; +use crate::support::{basic_manifest, clippy_is_available, is_nightly, project}; use std::io::Write; @@ -1318,8 +1318,17 @@ fn fix_with_clippy() { p.cargo("fix -Zunstable-options --clippy --allow-no-vcs") .masquerade_as_nightly_cargo() - .diff_lines("", "", false) .with_stderr(stderr) .with_stdout("") .run(); + + assert_eq!( + p.read_file("src/lib.rs"), + " + pub fn foo() { + let mut v = Vec::::new(); + let _ = v.iter_mut().filter(|a| a.is_empty()); + } + " + ); }