Skip to content

BUG: Rust lint consistently fails due to missing components #4816

@xShinnRyuu

Description

@xShinnRyuu

Describe the bug

The current implementation of our CI Rust linter process fails due to missing required components: rustfmt and clippy. These tools are not installed by default, leading to errors when the linter attempts to use them.

We rely on the dtolnay/rust-toolchain@stable GitHub Action to install the Rust toolchain. Internally, this action runs the following command:

rustup toolchain install stable --target x86_64-unknown-linux-gnu --profile minimal --no-self-update

In the action source code, the --profile minimal flag is used by default and only installs ["rustc", "cargo", "rust-std"]. Reference found here.

Expected Behavior

The linter should have both rustfmt and clippy explicitly installed to prevent failures when attempting to use these components. Without these components, Rust linting will fail due to missing tools in the environment.

Current Behavior

Linter fails to build when trying to use rustfmt which is not installed by the rustup toolchain install stable --target x86_64-unknown-linux-gnu --profile minimal --no-self-update command by default

Reproduction Steps

Refer to the recent FMT here: https://github.com/valkey-io/valkey-glide/actions/runs/17995844049/job/51195087345#step:3:151

Possible Solution

We need to explicitly install the rustfmt and clippy components when setting up the Rust toolchain to ensure the linter functions correctly.

To do this, add the components field under the with section of the dtolnay/rust-toolchain@stable action here. This will ensure that both tools are available during CI runs.

- uses: dtolnay/rust-toolchain@stable
  with:
    components: rustfmt, clippy

This change ensures that rustfmt and clippy are installed alongside the toolchain, preventing failures caused by missing components during linting.

Additional Information/Context

No response

Client version used

main

Engine type and version

All

OS

All

Language

Rust

Language Version

Technically its a YAML file change.

Cluster information

No response

Logs

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions