mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-31 18:42:08 +00:00
22 lines
538 B
Plaintext
22 lines
538 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, common]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# rustfmt
|
|
|
|
> Format Rust source code.
|
|
> More information: <https://github.com/rust-lang/rustfmt>.
|
|
|
|
- Format a file, overwriting the original file in-place:
|
|
|
|
`rustfmt {{path/to/source.rs}}`
|
|
|
|
- Check a file for formatting and display any changes on the console:
|
|
|
|
`rustfmt --check {{path/to/source.rs}}`
|
|
|
|
- Backup any modified files before formatting (the original file is renamed with a `.bk` extension):
|
|
|
|
`rustfmt --backup {{path/to/source.rs}}`
|