📎 clippy is available as a rustup component

No more nightly updates that break clippy. No more manually cargo install clippy. You can finally get the latest in annoying/helpful static analyses on a nightly near you in just 3 easy steps:

  1. rustup update (yes this is very important, no you can’t skip it, yes rustup self update && rustup update nightly is fine, too)
  2. rustup component add clippy-preview
  3. cargo clippy

Note that if you cargo uninstall clippy afterwards you will break your system and need to run rustup self update again to fix it.

Please spread the word to all those who (understandibly) didn’t want to use a tool that breaks every 10 days and then test it to your heart’s desires. Report any issues you have at https://github.com/rust-lang-nursery/rust-clippy/issues/new


IIRC, rustfmt-preview existed as a component for a few release cycles before its availability was actually announced in 1.24, still in preview. Do you know what the plans are for clippy in this regard?

(This will influence when I’ll try to start packaging clippy-preview in Fedora.)

I have been told clippy will ride the trains all the way to stable. So it’ll be in beta in 2 weeks and stable in 8 weeks.

The entire infrastructure has been setup to support this. So unless something drastic occurs, this is what’s going to happen.

1 Like

Awesome news! Will this ride the trains? (So that it will be available in stable by, I guess, 1.29.)

I guess I’m asking if it will just happen to land on stable 1.29, or if it will be announced in 1.29 and have some promise of remaining until its non-preview graduation. IOW, I don’t want to start packaging it in 1.29 if it might disappear in 1.30+ for whatever reason.

We’ll announce it for either 1.29 or 1.30

I see no reason why it would get removed


Wooooo! Finally!

Big thanks to @nrc for helping us plan this and push for this, @kennytm and @alexcrichton who advised us with the final steps with the integration, and @yaahc for helping with the implementation!

This has been something that we’ve been hoping for for years now, and it’s great to see it finally in a usable state!


Congrats clippy team!

This is great! How do I update clippy using rustup?

You don’t have to. That is done automatically when you update your nightly

EDIT: Its working, just needs to run rustup self update and make sure https://static.rust-lang.org/rustup/release-stable.toml is not cached by your proxy…

Not working here :frowning:

$ rustup show
Default host: x86_64-apple-darwin

installed toolchains

nightly-x86_64-apple-darwin (default)

active toolchain

nightly-x86_64-apple-darwin (default)
rustc 1.29.0-nightly (1ecf6929d 2018-07-16)

$ rustup component add clippy-preview
info: downloading component 'clippy-preview'
info: installing component 'clippy-preview'
$ cargo clippy
error: no such subcommand: `clippy`

For those running the stable channel as default, it’s possible to do the clippy-preview update for the nightly channel just using:

rustup udate
rustup component add --toolchain=nightly clippy-preview

and later, you can use clippy in your project like this:

cargo +nightly clippy

After rustup component add clippy-preview will rustup install clippy after a rustup update? I was told that this works, but I just did a rustup update and previously working rustfmt is now broken again until I do rustup component add rustfmt-preview. It’d be nice to not add these components every time I update the toolchain.

@osa1 it should, did your log mention updating rustfmt-preview during the rustup update? For example I just updated:

12:36 → rustup update stable
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2018-07-10, rust version 1.27.1 (5f2b325f6 2018-07-07)
info: downloading component 'rustfmt-preview'

12:38 → rustfmt --version
rustfmt 0.6.1-stable (49279d7 2018-05-08)

Maybe next release try rustup --verbose update | tee log and open a ticket with the log if it fails again (although, that’s very verbose and doesn’t seem like it includes much useful extra info).

did your log mention updating rustfmt-preview during the rustup update

It didn't. I'll save the verbose logs to a file and open a ticket if it doesn't install rustfmt and clippy the next time I do update.

FYI I’m suspecting this somehow broke my builds. I pin the version of nightly and clippy that I use and yet my clippy jobs have recently started failing. I’m unsure if this is expected or not.

I’m going ahead and making the switch to clippy-preview.

I saw this happen as well.

What seems to be happening is that rustup has provided a cargo-clippy binary already, so the cache-friendly install of clippy sees that binary there and doesn’t install from crates.io. Then trying to use it obviously fails because the binary just says that the current toolchain doesn’t have clippy.

A little annoying, but worth it to bring clippy onto the train, I think.

FYI, I don’t see clippy-preview in the component list for 1.29.0-beta.3.

ooops. We had a sanity check for helping ppl pick the right rustc version. That check complains about being built with the beta compiler. https://github.com/rust-lang/rust/pull/53199 should fix it.


Looks good on 1.29.0-beta.4!

1 Like