知识卡片
格式化固定项目风格
cargo fmt 在项目约定下整理样式,例如缩进和换行。自动格式化便于专注语义改动。若要比较差异,可在独立的工作区或提交中应用格式化。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 附录 D · 开发工具 Automatic Formatting with rustfmt · 查看原书依据
The rustfmt tool reformats your code according to the community code style. Many collaborative projects use rustfmt to prevent arguments about which style to use when writing Rust: everyone formats their code using the tool.
参考来源
- 位置:《The Rust Programming Language(第2版)》附录 D · 开发工具(来源项目 a19c7933-4eda-4176-aebd-30fe7e1ad292,`extracted/The Rust Programming Language(第2版)/_epub-src/b04.xhtml`,块 0005)
- 结论依据:原文说明 rustfmt 帮助团队以同一风格编排代码。
- 原始内容:The rustfmt tool reformats your code according to the community code style. Many collaborative projects use rustfmt to prevent arguments about which style to use when writing Rust: everyone formats their code using the tool.