How i can start use rustfmt?

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

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?

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.

1 Like

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: GitHub - rust-lang/rustfmt: Format Rust code

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:


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.