mirror of
https://github.com/tldr-pages/tldr.git
synced 2026-08-28 20:11:19 +08:00
867 B
867 B
rustfmt
格式化 Rust 原始碼。 更多資訊:https://github.com/rust-lang/rustfmt。
- 格式化檔案,就地覆蓋原始檔案:
rustfmt {{路徑/至/原始檔案.rs}}
- 檢查檔案的格式並在主控台顯示所有變更:
rustfmt --check {{路徑/至/原始檔案.rs}}
- 在格式化前備份所有修改的檔案(原始檔案會以
.bk副檔名重命名):
rustfmt --backup {{路徑/至/原始檔案.rs}}
- 使用特定的 Rust 風格版次(格式化規則)以詳細模式格式化程式碼:
rustfmt --style-edition {{2015|2018|2021|2024}} {{[-v|--verbose]}} {{路徑/至/原始檔案1.rs 路徑/至/原始檔案2.rs ...}}
- 使用特定的 Rust 版次(語言特性和解析)格式化程式碼:
rustfmt --edition {{2015|2018|2021|2024}} {{路徑/至/原始檔案1.rs 路徑/至/原始檔案2.rs ...}}