Skip to content

Move cargo-clippy into cargo #3837

@Manishearth

Description

@Manishearth
Member

See rust-lang/cargo#6664 (comment) for some context.

Currently cargo clippy is a thin wrapper script around Cargo that invokes cargo check with a RUSTC_WRAPPER: https://github.com/rust-lang/rust-clippy/blob/8dfabdf11c6cdaffd7c6e6552a6ead8d52c49b10/src/main.rs

It does some additional hacks to support the clippy dogfood test and passing down arguments.

We should move this into cargo proper, like rustc: Ideally it's just a copy of cargo check that sets a different rustc executable (temporarily can be done by overriding RUSTC_WRAPPER, but the better solution probably involves modifying config.rustc() https://github.com/rust-lang/cargo/blob/716b02cb4c7b75ce435eb06defa25bc2d725909c/src/cargo/util/config.rs#L194-L215

Steps:

Activity

Manishearth

Manishearth commented on Mar 3, 2019

@Manishearth
MemberAuthor

I think as a first step we should write a very basic cargo clippy-preview (nightly only?) subcommand for cargo that just is a copy of cargo check with rustc_wrapper set. We can also clean it up to make this part of the config.

We can then do the back and forth of testing it with clippy to ensure it works, and eventually rename and ship it. We should probably continue to ship cargo-clippy for a couple releases since in some cases you use a cargo from an older release.

Once we have this there are a bunch of nice changes we can make: e.g. we can modify the argument parsing so that you can just do cargo clippy -Wclippy::foo instead of needing the pesky --.

This also helps integration with cargo fix, since that can now be wholly solved on the cargo side.

Manishearth

Manishearth commented on Mar 3, 2019

@Manishearth
MemberAuthor

One implementation issue is that rustup currently does not export a clippy-driver binary, we should change it to do this.

Manishearth

Manishearth commented on Mar 3, 2019

@Manishearth
MemberAuthor

This could also be handled by using the current exe path I guess.

Manishearth

Manishearth commented on Mar 3, 2019

@Manishearth
MemberAuthor

Filed rust-lang/rustup#1678

I do have concerns as to how this will work for non-rustup users.

Manishearth

Manishearth commented on Mar 15, 2019

@Manishearth
MemberAuthor

@yaahallo is looking into implementing this

added a commit that references this issue on Apr 1, 2019
Manishearth

Manishearth commented on May 1, 2019

@Manishearth
MemberAuthor

Shouldn't have been closed

48 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @ehuss@kentfredric@TheBlueMatt@Manishearth@yaahc

      Issue actions

        Move cargo-clippy into cargo · Issue #3837 · rust-lang/rust-clippy