From 4e62fc97edb684426f38c325654a0edba82afd72 Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Wed, 18 Sep 2019 13:50:35 -0700 Subject: [PATCH 1/2] Rename clippy-preview to clippy and stabilize it --- src/bin/cargo/commands/clippy.rs | 9 +-------- src/bin/cargo/commands/mod.rs | 2 +- tests/testsuite/cache_messages.rs | 4 ++-- tests/testsuite/clippy.rs | 8 ++++---- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/bin/cargo/commands/clippy.rs b/src/bin/cargo/commands/clippy.rs index 4aa412ceeca..b206609b09d 100644 --- a/src/bin/cargo/commands/clippy.rs +++ b/src/bin/cargo/commands/clippy.rs @@ -4,7 +4,7 @@ use cargo::ops; use cargo::util; pub fn cli() -> App { - subcommand("clippy-preview") + subcommand("clippy") .about("Checks a package to catch common mistakes and improve your Rust code.") .arg(Arg::with_name("args").multiple(true)) .arg_package_spec( @@ -63,13 +63,6 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult { let mode = CompileMode::Check { test: false }; let mut compile_opts = args.compile_options(config, mode, Some(&ws))?; - if !config.cli_unstable().unstable_options { - return Err(failure::format_err!( - "`clippy-preview` is unstable, pass `-Z unstable-options` to enable it" - ) - .into()); - } - let mut wrapper = util::process(util::config::clippy_driver()); if let Some(clippy_args) = args.values_of("args") { diff --git a/src/bin/cargo/commands/mod.rs b/src/bin/cargo/commands/mod.rs index 16e02774db3..9e5b25a89c7 100644 --- a/src/bin/cargo/commands/mod.rs +++ b/src/bin/cargo/commands/mod.rs @@ -43,7 +43,7 @@ pub fn builtin_exec(cmd: &str) -> Option) -> Cli "build" => build::exec, "check" => check::exec, "clean" => clean::exec, - "clippy-preview" => clippy::exec, + "clippy" => clippy::exec, "doc" => doc::exec, "fetch" => fetch::exec, "fix" => fix::exec, diff --git a/tests/testsuite/cache_messages.rs b/tests/testsuite/cache_messages.rs index 7a104e959f3..e76f907688e 100644 --- a/tests/testsuite/cache_messages.rs +++ b/tests/testsuite/cache_messages.rs @@ -320,13 +320,13 @@ fn clippy() { .file("src/lib.rs", "pub fn f() { assert!(true); }") .build(); - p.cargo("clippy-preview -Zunstable-options -Zcache-messages") + p.cargo("clippy -Zcache-messages") .masquerade_as_nightly_cargo() .with_stderr_contains("[..]assert!(true)[..]") .run(); // Again, reading from the cache. - p.cargo("clippy-preview -Zunstable-options -Zcache-messages") + p.cargo("clippy -Zcache-messages") .masquerade_as_nightly_cargo() .with_stderr_contains("[..]assert!(true)[..]") .run(); diff --git a/tests/testsuite/clippy.rs b/tests/testsuite/clippy.rs index 5e5000ff83f..2cef4458eb8 100644 --- a/tests/testsuite/clippy.rs +++ b/tests/testsuite/clippy.rs @@ -26,13 +26,13 @@ fn clippy_force_rebuild() { .file("src/lib.rs", "pub fn f() { assert!(true); }") .build(); - p.cargo("clippy-preview -Zunstable-options -v") + p.cargo("clippy -v") .masquerade_as_nightly_cargo() .with_stderr_contains("[..]assert!(true)[..]") .run(); // Make sure it runs again. - p.cargo("clippy-preview -Zunstable-options -v") + p.cargo("clippy -v") .masquerade_as_nightly_cargo() .with_stderr_contains("[FRESH] dep1 v0.1.0") .with_stderr_contains("[..]assert!(true)[..]") @@ -61,13 +61,13 @@ fn clippy_passes_args() { .file("src/lib.rs", "pub fn f() { assert!(true); }") .build(); - p.cargo("clippy-preview -Zunstable-options -v -- -Aclippy::assertions_on_constants") + p.cargo("clippy -v -- -Aclippy::assertions_on_constants") .masquerade_as_nightly_cargo() .with_stderr_does_not_contain("[..]assert!(true)[..]") .run(); // Make sure it runs again. - p.cargo("clippy-preview -Zunstable-options -v") + p.cargo("clippy -v") .masquerade_as_nightly_cargo() .with_stderr_contains("[..]assert!(true)[..]") .run(); From 1c1ce64d028dadb89cffd9c67b64ab6da574a04d Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Wed, 18 Sep 2019 13:59:29 -0700 Subject: [PATCH 2/2] Stabilize `cargo fix --clippy` --- src/bin/cargo/commands/fix.rs | 8 -------- tests/testsuite/fix.rs | 8 +------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/bin/cargo/commands/fix.rs b/src/bin/cargo/commands/fix.rs index 471d05a4c95..f8fa3cc3177 100644 --- a/src/bin/cargo/commands/fix.rs +++ b/src/bin/cargo/commands/fix.rs @@ -76,7 +76,6 @@ pub fn cli() -> App { Arg::with_name("clippy") .long("clippy") .help("Get fix suggestions from clippy instead of rustc") - .hidden(true) .multiple(true) .min_values(0) .number_of_values(1), @@ -142,13 +141,6 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult { .or_else(|| Some(vec![])) .filter(|_| use_clippy); - if use_clippy && !config.cli_unstable().unstable_options { - return Err(failure::format_err!( - "`cargo fix --clippy` is unstable, pass `-Z unstable-options` to enable it" - ) - .into()); - } - if let CompileFilter::Default { .. } = opts.filter { opts.filter = CompileFilter::Only { all_targets: true, diff --git a/tests/testsuite/fix.rs b/tests/testsuite/fix.rs index 510b211ce1c..89cd1a4d85e 100644 --- a/tests/testsuite/fix.rs +++ b/tests/testsuite/fix.rs @@ -1251,12 +1251,6 @@ fn fix_in_existing_repo_weird_ignore() { #[cargo_test] fn fix_with_clippy() { - if !is_nightly() { - // fix --clippy is unstable - eprintln!("skipping test: requires nightly"); - return; - } - if !clippy_is_available() { return; } @@ -1279,7 +1273,7 @@ fn fix_with_clippy() { [FINISHED] [..] "; - p.cargo("fix -Zunstable-options --clippy --allow-no-vcs") + p.cargo("fix --clippy --allow-no-vcs") .masquerade_as_nightly_cargo() .with_stderr(stderr) .with_stdout("")