How i can start use rustfmt?


#1

Hi, guys. How i can start use rustfmt? Thanks :slightly_smiling_face:


#2

Hi There

Your question is too generic. I have 3 questions for you:

  1. Have you gone through the documentation?
  2. Is there any specific thing you are having an issue with on how to use rustfmt as explained in the doc?
  3. Have you tried doing it and got stuck somewhere?

#3

Sorry, I thought that this documentation (repository) is not official. It would be nice if it was shipped with Rust and was run by a simple rustfmt command for example.


#4

As of the next release, it will be on the stable channel. Until then, you can install it on the nightly channel as described here: https://github.com/rust-lang-nursery/rustfmt#quick-start

One command is one more than “included by default”, but we’re just not ready yet.

cargo fmt is only one character longer, thanks to the space :slight_smile:


#5

It is rather complex.

At now you should use beta variant of compiler:

rustup default beta

then make sure that rustfmt installed:

rustup component add --toolchain beta rustfmt-preview

at now rustfmt and cargo fmt should works.