rust-lang / docker-rust-nightly

63 stars 30 forks source link

Include rustfmt and clippy #25

Open mleonhard opened 4 years ago

mleonhard commented 4 years ago

Thanks for making this docker image. I'm using it with Gitlab CI. One issue is that many nightly versions have no rustfmt or clippy.

How about including the latest rustfmt and clippy in the image? This would help me out a lot. It would speed up CI jobs, reduce CI flakiness from download errors, and eliminate the need for extra docker images.

mleonhard commented 4 years ago

Example error:

$ date -u
Thu Oct 29 07:41:32 UTC 2020
$ docker images --all |grep rustlang
rustlang/rust                                     nightly             e40103be369d        13 hours ago        1.6GB
$ docker run --interactive --tty --rm rustlang/rust:nightly
root@56ce9e3100f5:/# mkdir pkg1 
root@56ce9e3100f5:/# cd pkg1
root@56ce9e3100f5:/pkg1# export USER=user1
root@56ce9e3100f5:/pkg1# cargo init
     Created binary (application) package
root@56ce9e3100f5:/pkg1# cargo fmt --all -- --check
error: the 'rustfmt' component which provides the command 'cargo-fmt' is not available for the 'nightly-x86_64-unknown-linux-gnu' toolchain
mleonhard commented 4 years ago

The instrumentisto/rust images have clippy and rustfmt.

Related: "Include rustfmt and clippy components by default" https://github.com/rust-lang/docker-rust/issues/37

tyranron commented 4 years ago

@mleonhard instrumentisto/rust nightly images are nothing more than these rustlang/rust:nightly images. All the instrumentisto does about nightly images is just preserving all the versions in tags. So there is literally no difference between them (you can even compare the hash of latest image to ensure).

But... not every nightly Rust version has rustfmt, clippy or other components. Sometimes nightly version misses them. You can track the components availability here: https://rust-lang.github.io/rustup-components-history/index.html

But beware, that nightly version tag in instrumentisto/rust differs with the one published on the page by one day. That's because rustc version shipped in nightly version is always of the previous day, and Docker image is tagged by taking the rustc version.