Formatting Rust Code

November 08, 2022

To install:

    rustup component add rustfmt

To run on a cargo project in the current working directory:

    cargo fmt

To format individual files

    rustfmt lib/lib.rs src/main.rs

Official Documentation


Profile picture

Things I've learned, collected in luisjuarros/til.
You may also enjoy my blog and/or my twitter.