Rust-clippy: Switch cargo-clippy over to use rustup's clippy-driver

Created on 8 Jul 2018  路  5Comments  路  Source: rust-lang/rust-clippy

Currently cargo-clippy calls the associated cargo installd clippy-driver. Now that we ship clippy-preview, we can instead make it call the one from rustup!

Currently I have to hack this together to run clippy with clippy-preview: https://twitter.com/ManishEarth/status/1015818090548944896

$ CARGO_MANIFEST_DIR=. ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/clippy-driver src/main.rs --emit=dep-info,metadata 

We can use ${RUSTUP_HOME}/toolchains/${RUSTUP_TOOLCHAIN} to find the driver. Alternatively, we perhaps can do something like rustfmt so that it's in the path (not sure how this works)

Perhaps we should be shipping cargo-clippy via rustup too? This is what rustfmt does, and it's one fewer step for installing clippy.

cc @kennytm @oli-obk

Most helpful comment

Yea, seems like the most sensible thing to just ship cargo-clippy

All 5 comments

Yea, seems like the most sensible thing to just ship cargo-clippy

cc @kennytm what should we do here for this?

Also, how do we get rustup to put these things in the PATH?

I agreed with @oli-obk that we should just ship cargo-clippy, like cargo-fmt.

@Manishearth The rustfmt support in rustup was added in rust-lang-nursery/rustup.rs#1294. You'll need to add cargo-clippy (and maybe clippy-driver too) to the DUP_TOOLS array in src/rustup-cli/self_update.rs and TOOLS array in rc/rustup-win-installer/src/lib.rs, and have rustup release a new version.

FWIW it should be okay if preexisting cargo-clippy is overwritten since clippy is going to break anyway

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Manishearth picture Manishearth  路  20Comments

Shnatsel picture Shnatsel  路  23Comments

dtolnay picture dtolnay  路  20Comments

kevincox picture kevincox  路  17Comments

Manishearth picture Manishearth  路  26Comments