3.3. cargo での rustfmt の使用
cargo crate のすべてのソースファイルをフォーマットするには、次のコマンドを実行します。
Red Hat Enterprise Linux 7 の場合:
scl enable rust-toolset-1.35 'cargo fmt'
$ scl enable rust-toolset-1.35 'cargo fmt'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Red Hat Enterprise Linux 8 の場合:
cargo fmt
$ cargo fmt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
rustfmt
フォーマットオプションを変更するには、プロジェクトディレクトリーに設定ファイル rustfmt.toml
を作成し、そこに設定を指定します。詳細は、rustfmt
のヘルプメッセージを参照してください。
Red Hat Enterprise Linux 7 の場合:
scl enable rust-toolset-1.35 'rustfmt --config-help'
$ scl enable rust-toolset-1.35 'rustfmt --config-help'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Red Hat Enterprise Linux 8 の場合:
rustfmt --config-help
$ rustfmt --config-help
Copy to Clipboard Copied! Toggle word wrap Toggle overflow