2018-09-11 19:04:32 +01:00
|
|
|
# rustfmt
|
|
|
|
|
|
|
|
> Tool for formatting Rust source code.
|
2019-05-23 11:56:50 +01:00
|
|
|
> More information: <https://github.com/rust-lang/rustfmt>.
|
2018-09-11 19:04:32 +01:00
|
|
|
|
|
|
|
- Format a file, overwriting the original file in-place:
|
|
|
|
|
2023-01-04 04:27:33 +00:00
|
|
|
`rustfmt {{path/to/source.rs}}`
|
2018-09-11 19:04:32 +01:00
|
|
|
|
|
|
|
- Check a file for formatting and display any changes on the console:
|
|
|
|
|
2023-01-04 04:27:33 +00:00
|
|
|
`rustfmt --check {{path/to/source.rs}}`
|
2018-09-11 19:04:32 +01:00
|
|
|
|
|
|
|
- Backup any modified files before formatting (the original file is renamed with a `.bk` extension):
|
|
|
|
|
2023-01-04 04:27:33 +00:00
|
|
|
`rustfmt --backup {{path/to/source.rs}}`
|