---
# System prepended metadata

title: Clippy<->bootstrap

---

# Clippy<->bootstrap

## Current situation and how to improve it

those 2 builds are need, because clippy can't be built with the bootstrap compiler
need the stage 2 compiler, if we want to use nightly features added since the last beta version

We can use `cfg(bootstrap)` to get around this.

Doing the same thing rustdoc and miri does should be quite straight forward.

## Clippy workspace

Following what `cargo` does, then this should also not be a problem.
Using rustc-internal should also not be an issue when moving to a workspace

## Cargo.lock file in Clippy repo

Lock file syncs might be annoying
One alternative would also be to not sync the Cargo.lock file
    - Would not benefit from rustc infra for lock file update
    
## Testing individual clippy tests

Make `TESTNAME` work in the Rust repo

## Uplifting clippy lints to rustc

Clippy lints might be narrowed when uplifting
- They then should not overlap
- Clippy lint should still existing

Before uplifting: 
- first agree what the uplifted lint should specifically do
- Ensure that the lint documentation properly describes what the lint does

(Ideas)

## De-duplicate lints


Extend the duplicated diag infra, so that a lint can gate on another lint triggering on e.g. a `Span`

## Include Clippy in `cargo-check`/`rustc-driver`

Motivation: `cargo check` emits metadata, but `cargo clippy` doesn't (today).

Might allow more code sharing between Clippy lints and rustc lints. This could simplifiy uplifting lints, by just turning a Clippy (tool) lint into a rustc lint
With this, `cargo check -Wclippy` (or similar) could run Clippy
- Could be done today with `RUSTC=clippy-driver cargo check`
    - Should not be the interface (obviously)

Clippy also allows `cargo clippy --explain clippy::unwrap_used`/`cargo clippy --explain unwrap_used` or `cargo clippy -- -Wclippy::unwrap_used` which would be nice to also have when including Clippy in `cargo check`

it would be cool if `cargo test -W clippy` did all the things you need (this may be the stronger motivation, avoiding two builds per CI build)


[lints.clippy] in cargo.toml could be on by default?


## Follow up todos

- [ ] File issues for stage0 Clippy build, Cargo workspace and Cargo.lock file

