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