Rustfmt on 1.23


#1

If I am reading the release notes correctly, Rustfmt now comes by default with Rust:

Release tarballs now come with rustfmt

Should this be mentioned in 1.23 blogpost perhaps?


#2

I would also appreciate some docs on how to use this :slight_smile:

So far, I’ve found that rustup component add rustfmt-preview installs rustfmt. Is there any way to install cargo-fmt as well?


#3

Installing rustfmt should also install cargo-fmt, shouldn’t it?


#4

This does not seem to be the case

~/projects/rustraytracer master*
λ rustup component add rustfmt-preview                                                                             ~/projects/rustraytracer
info: component 'rustfmt-preview' for target 'x86_64-unknown-linux-gnu' is up to date

~/projects/rustraytracer master*
λ rustfmt --version                                                                                                ~/projects/rustraytracer
0.2.16-nightly (2bfcadf 2017-11-21)

~/projects/rustraytracer master*
λ cargo fmt --help                                                                                                 ~/projects/rustraytracer
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not have the binary `cargo-fmt`

~/projects/rustraytracer master*
λ rustup component list                                                                                            ~/projects/rustraytracer
cargo-x86_64-unknown-linux-gnu (default)
rls-preview-x86_64-unknown-linux-gnu
rust-analysis-x86_64-unknown-linux-gnu
rust-docs-x86_64-unknown-linux-gnu (default)
rust-src (installed)
rust-std-aarch64-apple-ios
rust-std-aarch64-linux-android
rust-std-aarch64-unknown-fuchsia
rust-std-aarch64-unknown-linux-gnu
rust-std-aarch64-unknown-linux-musl
rust-std-arm-linux-androideabi
rust-std-arm-unknown-linux-gnueabi
rust-std-arm-unknown-linux-gnueabihf
rust-std-arm-unknown-linux-musleabi
rust-std-arm-unknown-linux-musleabihf
rust-std-armv7-apple-ios
rust-std-armv7-linux-androideabi
rust-std-armv7-unknown-linux-gnueabihf
rust-std-armv7-unknown-linux-musleabihf
rust-std-armv7s-apple-ios
rust-std-asmjs-unknown-emscripten
rust-std-i386-apple-ios
rust-std-i586-pc-windows-msvc
rust-std-i586-unknown-linux-gnu
rust-std-i686-apple-darwin
rust-std-i686-linux-android
rust-std-i686-pc-windows-gnu
rust-std-i686-pc-windows-msvc
rust-std-i686-unknown-freebsd
rust-std-i686-unknown-linux-gnu
rust-std-i686-unknown-linux-musl
rust-std-mips-unknown-linux-gnu
rust-std-mips-unknown-linux-musl
rust-std-mips64-unknown-linux-gnuabi64
rust-std-mips64el-unknown-linux-gnuabi64
rust-std-mipsel-unknown-linux-gnu
rust-std-mipsel-unknown-linux-musl
rust-std-powerpc-unknown-linux-gnu
rust-std-powerpc64-unknown-linux-gnu
rust-std-powerpc64le-unknown-linux-gnu
rust-std-s390x-unknown-linux-gnu
rust-std-sparc64-unknown-linux-gnu
rust-std-sparcv9-sun-solaris
rust-std-wasm32-unknown-emscripten
rust-std-x86_64-apple-darwin
rust-std-x86_64-apple-ios
rust-std-x86_64-linux-android
rust-std-x86_64-pc-windows-gnu
rust-std-x86_64-pc-windows-msvc
rust-std-x86_64-rumprun-netbsd
rust-std-x86_64-sun-solaris
rust-std-x86_64-unknown-freebsd
rust-std-x86_64-unknown-fuchsia
rust-std-x86_64-unknown-linux-gnu (default)
rust-std-x86_64-unknown-linux-gnux32
rust-std-x86_64-unknown-linux-musl
rust-std-x86_64-unknown-netbsd
rust-std-x86_64-unknown-redox
rustc-x86_64-unknown-linux-gnu (default)
rustfmt-preview-x86_64-unknown-linux-gnu (installed)

#5

Ah, seems it is not supposed to work yet: https://www.reddit.com/r/rust/comments/7o40q0/announcing_rust_123/ds6uloa/