Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 1.58 KB

rustfmt.md

File metadata and controls

56 lines (39 loc) · 1.58 KB
description title layout
Rustfmt is a code formatting tool for Rust that helps ensure your code adheres to the community-driven coding standards and style guidelines.
Trunk | How to run rustfmt
title description tableOfContents outline pagination
visible
true
visible
visible
true
visible
true
visible
true

rustfmt

rustfmt is a formatter for Rust.

You can enable the rustfmt formatter with:

trunk check enable rustfmt

Auto Enabling

rustfmt will be auto-enabled if any Rust files are present.

Settings

rustfmt supports the following config files:

  • rustfmt.toml
  • .rustfmt.toml

You can move these files to .trunk/configs and trunk check will still find them. See Moving Linters for more info. Trunk Code Quality provides a default .rustfmt.toml if your project does not already have one.

Usage Notes

We currently use the version of rustfmt packaged with rust, so for rustfmt version, specify your Rust version (for example [email protected]).

If you have edition in your cargo.toml, rustfmt also needs the same information in .rustfmt.toml in your repo root. For example, your .rustfmt.toml might contain:

edition = "2021"

Links