Skip to content

Stabilize fix --clippy #7383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/bin/cargo/commands/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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") {
Expand Down
8 changes: 0 additions & 8 deletions src/bin/cargo/commands/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn builtin_exec(cmd: &str) -> Option<fn(&mut Config, &ArgMatches<'_>) -> 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,
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cache_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions tests/testsuite/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)[..]")
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 1 addition & 7 deletions tests/testsuite/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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("")
Expand Down