第 3 章 rustfmt 格式工具
使用 rustfmt
格式工具,您可以自动格式化 Rust 程序的源代码。您可以将 rusftmt
用作独立工具,或通过 gego 使用。
3.1. 安装 rustfmt
完成以下步骤以安装 rustfmt
格式工具。
先决条件
-
已安装 Rust Toolset。
如需更多信息,请参阅安装 Rust Toolset。
流程
运行以下命令来安装 rustfmt
:
在 Red Hat Enterprise Linux 7 上:
# yum install rust-toolset-1.66-rustfmt
在 Red Hat Enterprise Linux 8 中:
# yum install rustfmt
在 Red Hat Enterprise Linux 9 中:
# dnf install rustfmt