rust-lang / rust-lang/rust-clippy

`default_trait_access` autofix not working

Open
#17,565 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

L-pedantic L-suggestion
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Description

Hi

I find clippy very very useful and one lint I get a lot is default_trait_access. For some reason, it doesn't autofix when this is available even though the fix is suggested.

It's implemented here, but there's a comment that references a TODO that doesn't seem to exist:
https://github.com/rust-lang/rust-clippy/blob/e52501913b75235e3d41422566a2d05d6f00b699/clippy_lints/src/default.rs#L97-L105
This was authored by @flip1995 (perhaps you can help)?

There's also this suspicious file with errors tests/ui/default_trait_access.rs and fixes tests/ui/default_trait_access.fixed, so maybe my settings aren't correct.

Please, let me know and I'd be happy to implement this once the mysterious TODO comment is resolved.

Version
rustc 1.97.0 (2d8144b78 2026-07-07)
binary: rustc
commit-hash: 2d8144b7880597b6e6d3dfd63a9a9efae3f533d3
commit-date: 2026-07-07
host: x86_64-unknown-linux-gnu
release: 1.97.0
LLVM version: 22.1.6
Additional Labels

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in clippy_lints/src/default.rs around the default_trait_access implementation and inspect the TODO comment. Compare tests/ui/default_trait_access.rs with tests/ui/default_trait_access.fixed, then run the relevant UI test to reproduce the missing autofix. Done means the suggested default_trait_access change is applied correctly and the regression coverage passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.