If you use the rustup tool, then to install rustfmt, you need to add the corresponding component using the following command:
rustup component add rustfmt
If you want to install the latest version, you can do it directly from the repository:
cargo install --git https://github.com/rust-lang/rustfmt
The installation from source code requires compilation time and can be unstable, but you will have the latest features.