Skip to content

call clippy-driver directly rather than as a rustc_wrapper #7006

@yaahc

Description

@yaahc

As part of our ongoing effort in rust-lang/rust-clippy#3837 to move clippy up into cargo so we can integrate it with fix and maybe other features that @Manishearth can add we're thinking the next step is to tweek clippy-preview so that it calls clippy-driver directly rather than treating it like a rustc wrapper.

When we looked into making it so that clippy-driver can be called as rustc instead of as a rustc wrapper, we realized it really doesn't do anything when its being a wrapper other than remove the rustc argument from the args list. So we should already be good to go on that front.

I'd like to implement this feature myself but manish and I don't know cargo well enough to know the proper way to go about it and manish recommended I ask @alexcrichton and @killercup for ideas on how to go about doing it.

Some additional questions from manish

  • can this be done easily?
  • would this help fix integration? if not, what would?
  • can we make this work such that build scripts still get the original RUSTC ?

rust-lang/rust-clippy#2087 is relevant to that last question

cc @ehuss

Edit: tracking the checklist in original post rather than below

  • implement cargo fix --clippy over cargo clippy-preview --fix (gonna gate the --clippy arg behind the unstable flag in the same way clippy-preview is gated)
  • implement wrapper for primary crate only logic unnecessary
    • support using the wrapper for all local workspace crates when using the --all flag unnecessary
  • implement clippy argument passthrough for cargo fix
  • have clippy override the fingerprint to force a run when using cargo fix unnecessary?
  • add a test for cargo fixing a clippy lint, @Manishearth what is a good stable clippy lint to use?
  • move clippy is available test from cache_message.rs to somewhere more clippy centric, along with above new test.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions