How To Install rustfmt on Fedora 34

rustfmt is Tool to find and fix Rust formatting issues

Introduction

In this tutorial we learn how to install rustfmt on Fedora 34.

What is rustfmt

A tool for formatting Rust code according to style guidelines.

We can use yum or dnf to install rustfmt on Fedora 34. In this tutorial we discuss both methods but you only need to choose one of method to install rustfmt.

Install rustfmt on Fedora 34 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install rustfmt using dnf by running the following command:

sudo dnf -y install rustfmt

Install rustfmt on Fedora 34 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

Fedora 34 - x86_64                               20 kB/s | 6.6 kB     00:00
Fedora 34 openh264 (From Cisco) - x86_64        1.4 kB/s | 989  B     00:00
Fedora Modular 34 - x86_64                       68 kB/s | 6.5 kB     00:00
Fedora 34 - x86_64 - Updates                    3.5 kB/s | 6.2 kB     00:01
Fedora Modular 34 - x86_64 - Updates             17 kB/s | 5.9 kB     00:00
Metadata cache created.

After updating yum database, We can install rustfmt using yum by running the following command:

sudo yum -y install rustfmt

How To Uninstall rustfmt on Fedora 34

To uninstall only the rustfmt package we can use the following command:

sudo dnf remove rustfmt

rustfmt Package Contents on Fedora 34

/usr/bin/cargo-fmt
/usr/bin/rustfmt
/usr/lib/.build-id
/usr/lib/.build-id/2c
/usr/lib/.build-id/2c/a47b76b178c73a22961120613015ccd1f6f5e6
/usr/lib/.build-id/84
/usr/lib/.build-id/84/427466965e6d2aa3ed1893007f946ddaf8cbf9
/usr/share/doc/rustfmt
/usr/share/doc/rustfmt/CHANGELOG.md
/usr/share/doc/rustfmt/Configurations.md
/usr/share/doc/rustfmt/README.md
/usr/share/licenses/rustfmt
/usr/share/licenses/rustfmt/LICENSE-APACHE
/usr/share/licenses/rustfmt/LICENSE-MIT
/usr/bin/cargo-fmt
/usr/bin/rustfmt
/usr/lib/.build-id
/usr/lib/.build-id/62
/usr/lib/.build-id/62/675d037fe6a4b54689e8c183c32bd7b0cc826d
/usr/lib/.build-id/ce
/usr/lib/.build-id/ce/d2f83e220872ac43503055300da0078f1e917e
/usr/share/doc/rustfmt
/usr/share/doc/rustfmt/CHANGELOG.md
/usr/share/doc/rustfmt/Configurations.md
/usr/share/doc/rustfmt/README.md
/usr/share/licenses/rustfmt
/usr/share/licenses/rustfmt/LICENSE-APACHE
/usr/share/licenses/rustfmt/LICENSE-MIT

References

Summary

In this tutorial we learn how to install rustfmt on Fedora 34 using yum and dnf.