Skip to content
Merged
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ style_edition = "2024"

## Tips

* When using `rustfmt` directly in a Cargo project, Cargo will determine [`edition`](#rusts-editions) from `Cargo.toml`, but rustfmt will not, as it has its own configuration file, `rustfmt.toml`.
To ensure consistent parsing between `cargo fmt` and `rustfmt`, you should configure the [`edition`](#rusts-editions) in your `rustfmt.toml` file.
To ensure consistent formatting between `cargo fmt` and `rustfmt`, you should configure the [`style_edition`](#style-editions) in your `rustfmt.toml` file.

* For things you do not want rustfmt to mangle, use `#[rustfmt::skip]`
* To prevent rustfmt from formatting a macro or an attribute,
use `#[rustfmt::skip::macros(target_macro_name)]` or
Expand Down Expand Up @@ -241,8 +245,6 @@ style_edition = "2024"
| checkstyle | emits in a checkstyle format | Yes |
| json | emits diffs in a json format | Yes |

* When using `rustfmt` directly in a Cargo project, set the `style_edition` or `edition` in `rustfmt.toml` to the same value as in `Cargo.toml` to ensure consistent formatting. For more details, see the [Style Editions](#style-editions) and [Rust's Editions](#rusts-editions) sections.

## License

Rustfmt is distributed under the terms of both the MIT license and the
Expand Down
Loading