Clippy and Rustfmt on stable Rust 1.31


#1

As mentioned in Rust 1.31 release notes, Clippy and Rustfmt are available on stable Rust. However, when I run rustup component add clippy and rustup component add rustfmt, I got the following errors:

error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'clippy' for target 'x86_64-unknown-linux-gnu'
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rustfmt' for target 'x86_64-unknown-linux-gnu'

cargo version cargo 1.31.0 (339d9f9c8 2018-11-16)

rustc --version rustc 1.31.0 (abe02cefd 2018-12-04)

rustup --version rustup 1.16.0 (beab5ac2b 2018-12-06)


#2

Did you upgrade rustup AFTER your upgradation to 1.31? If so, uninstalling the toolchain and reinstall it will help, but i’m not sure if there’s an easier method.


#3

thanks, reinstalling toolchain fixed the problem


#4

I’m having the same problem, but I’m on wondows, even after a reinstall it doesn’t work. Do you know if there is a way to fix it?


#5

I had the same problem but it seems fixed now. For the record these are the commands I ran (the order of the commands is important):

rustup self update
rustup toolchain uninstall stable
rustup toolchain install stable

rustup --version should give you 1.16. If that doesn’t work you could try rustup self uninstall and then download rust again.


#6

I already tried that, I even uninstalled and reinstalled rustup but it didn’t work.


#7

Same here for me

PS C:\Windows\system32> rustup self update
info: checking for self-updates
PS C:\Windows\system32> rustup toolchain remove stable-x86_64-pc-windows-gnu
info: uninstalling toolchain 'stable-x86_64-pc-windows-gnu'
info: toolchain 'stable-x86_64-pc-windows-gnu' uninstalled
PS C:\Windows\system32> rustup toolchain install stable-x86_64-pc-windows-gnu
info: syncing channel updates for 'stable-x86_64-pc-windows-gnu'
info: latest update on 2018-12-06, rust version 1.31.0 (abe02cefd 2018-12-04)
info: downloading component 'rustc'
 78.0 MiB /  78.0 MiB (100 %)   6.2 MiB/s ETA:   0 s
info: downloading component 'rust-std'
 53.4 MiB /  53.4 MiB (100 %)   8.0 MiB/s ETA:   0 s
info: downloading component 'cargo'
info: downloading component 'rust-docs'
  8.5 MiB /   8.5 MiB (100 %)   7.2 MiB/s ETA:   0 s
info: downloading component 'rust-mingw'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: installing component 'rust-mingw'

  stable-x86_64-pc-windows-gnu installed - rustc 1.31.0 (abe02cefd 2018-12-04)

PS C:\Windows\system32> rustup component add rustfmt
error: component 'rustfmt' for target 'x86_64-pc-windows-gnu' is unavailable for download
PS C:\Windows\system32>

Woops. It looks like it was caused by “nightly-by-default”. See log below:

PS C:\Users\pzixe> rustup toolchain list
stable-x86_64-pc-windows-gnu
nightly-x86_64-pc-windows-gnu (default)
PS C:\Users\pzixe> rustup toolchain list^C
PS C:\Users\pzixe> rustup default stable-x86_64-pc-windows-gnu
info: using existing install for 'stable-x86_64-pc-windows-gnu'
info: default toolchain set to 'stable-x86_64-pc-windows-gnu'

  stable-x86_64-pc-windows-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04)

PS C:\Users\pzixe> rustup toolchain list
stable-x86_64-pc-windows-gnu (default)
nightly-x86_64-pc-windows-gnu
PS C:\Users\pzixe> rustup component add rustfmt
info: downloading component 'rustfmt'
info: installing component 'rustfmt'
PS C:\Users\pzixe>

#8

That was my issue too! Thanks!