Skip to content

Commit 8b1f599

Browse files
committed
back in tip top shape
1 parent 6fb65f1 commit 8b1f599

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

src/bin/cargo/commands/fix.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,6 @@ pub fn cli() -> App {
7878
.help("Get fix suggestions from clippy instead of rustc")
7979
.hidden(true),
8080
)
81-
.arg(
82-
Arg::with_name("clippy-arg")
83-
.long("clippy-arg")
84-
.help("Args to pass through to clippy, implies --clippy")
85-
.hidden(true)
86-
.multiple(true)
87-
.number_of_values(1),
88-
)
8981
.after_help(
9082
"\
9183
This Cargo subcommand will automatically take rustc's suggestions from
@@ -139,7 +131,11 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
139131
// code as we can.
140132
let mut opts = args.compile_options(config, mode, Some(&ws))?;
141133

142-
let clippy_args = args.values_of_lossy("clippy-args");
134+
let clippy_args = args
135+
.value_of("clippy") // always yields None
136+
.map(|s| s.split(' ').map(|s| s.to_string()).collect())
137+
.or_else(|| Some(vec![]));
138+
143139
let use_clippy = args.is_present("clippy") || clippy_args.is_some();
144140

145141
if use_clippy && !config.cli_unstable().unstable_options {
@@ -171,7 +167,6 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
171167
allow_no_vcs: args.is_present("allow-no-vcs"),
172168
allow_staged: args.is_present("allow-staged"),
173169
broken_code: args.is_present("broken-code"),
174-
use_clippy,
175170
clippy_args,
176171
},
177172
)?;

src/cargo/util/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,6 +1790,6 @@ impl Drop for PackageCacheLock<'_> {
17901790
/// Allows override of the path via `CARGO_CLIPPY_DRIVER` env variable
17911791
pub fn clippy_driver() -> PathBuf {
17921792
env::var("CARGO_CLIPPY_DRIVER")
1793-
.unwrap_or_else(|_| "clippy_driver".into())
1793+
.unwrap_or_else(|_| "clippy-driver".into())
17941794
.into()
17951795
}

tests/testsuite/clippy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::support::{clippy_is_available, is_nightly, process, project};
1+
use crate::support::{clippy_is_available, is_nightly, project};
22

33
#[cargo_test]
44
fn clippy() {

tests/testsuite/fix.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fs::File;
33
use git2;
44

55
use crate::support::git;
6-
use crate::support::{basic_manifest, project};
6+
use crate::support::{basic_manifest, clippy_is_available, is_nightly, project};
77

88
use std::io::Write;
99

@@ -1318,8 +1318,17 @@ fn fix_with_clippy() {
13181318

13191319
p.cargo("fix -Zunstable-options --clippy --allow-no-vcs")
13201320
.masquerade_as_nightly_cargo()
1321-
.diff_lines("", "", false)
13221321
.with_stderr(stderr)
13231322
.with_stdout("")
13241323
.run();
1324+
1325+
assert_eq!(
1326+
p.read_file("src/lib.rs"),
1327+
"
1328+
pub fn foo() {
1329+
let mut v = Vec::<String>::new();
1330+
let _ = v.iter_mut().filter(|a| a.is_empty());
1331+
}
1332+
"
1333+
);
13251334
}

0 commit comments

Comments
 (0)