back in tip top shape

This commit is contained in:
Jane Lusby 2019-06-26 11:27:54 -07:00
parent 6fb65f1e4f
commit 8b1f599dfd
4 changed files with 18 additions and 14 deletions

View File

@ -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,
},
)?;

View File

@ -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()
}

View File

@ -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() {

View File

@ -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::<String>::new();
let _ = v.iter_mut().filter(|a| a.is_empty());
}
"
);
}