tldr/pages.zh/common/rustfmt.md

17 lines
448 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# rustfmt
> 格式化 Rust 源代码的工具。
> 更多信息:<https://github.com/rust-lang/rustfmt>.
- 格式化文件,就地覆盖原始文件:
`rustfmt {{路径/到/源文件.rs}}`
- 检查文件的格式并在控制台上显示所有更改:
`rustfmt --check {{路径/到/源文件.rs}}`
- 格式化之前,备份所有修改过的文件(原始文件的扩展名为 `.bk`
`rustfmt --backup {{路径/到/源文件.rs}}`