Skip to content

tools: add rustfix aspect to apply clippy suggestions#19

Merged
oliverlee merged 4 commits into
mainfrom
rustfix
Mar 18, 2026
Merged

tools: add rustfix aspect to apply clippy suggestions#19
oliverlee merged 4 commits into
mainfrom
rustfix

Conversation

@oliverlee

@oliverlee oliverlee commented Mar 17, 2026

Copy link
Copy Markdown
Collaborator

Adds a rustfix aspect that consumes .clippy.diagnostics files produced by rust_clippy_aspect and applies MachineApplicable suggestions directly to source files.

The aspect runs unsandboxed with no-cache to allow writing back to the workspace source tree, and only invokes the rustfix binary when diagnostics are present. A phony marker file is always produced so the action is valid regardless of whether any fixes were applied.

The rustfix config in .bazelrc also disables the persistent action cache via --use_action_cache=false. The no-cache tag only disables disk and remote cache — not the persistent action cache — so this flag is required to ensure stale cached actions don't suppress re-running fixes after source changes. See bazelbuild/bazel#15516.

bazel build --config=rustfix //...

resolves #11

Base automatically changed from clippy-no-fail to main March 18, 2026 06:12
Adds a `rustfix` aspect that consumes `.clippy.diagnostics` files produced
by `rust_clippy_aspect` and applies `MachineApplicable` suggestions directly
to source files.

The aspect runs unsandboxed with `no-cache` to allow writing back to the
workspace source tree, and only invokes the `rustfix` binary when
diagnostics are present. A phony marker file is always produced so the
action is valid regardless of whether any fixes were applied.

```sh
bazel build --config=rustfix //...
```

@mickvangelderen mickvangelderen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

@oliverlee oliverlee merged commit 32a22e3 into main Mar 18, 2026
6 checks passed
@oliverlee oliverlee deleted the rustfix branch March 18, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto format auto fix lints command

2 participants