rust-lang / rust-lang/rust-clippy

`cargo dev rename_lint` misses the lint pass name in `clippy_lints/src/lib.rs`

Open
#15,976 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

I had this happen when renaming empty_enum to empty_enums -- both the file and the lint pass struct were renamed (to empty_enums and EmptyEnums, respectively), but in clippy_lints/src/lib.rs, only the module name was updated, but not the struct name:

store.register_late_pass(|_| Box::new(empty_enums::EmptyEnum));

It would be nice if that was updated as well.

Reproducer

I tried this code:

git switch --detach 1ecb18a18211c86a2a2f00ef3b0ef4c54f54d0d2
cargo dev rename_lint empty_enum empty_enums

I expected to see this happen:
The struct was renamed in clippy_lints/src/lib.rs

Instead, this happened:
It wasn't

Version
rustc 1.92.0-nightly (57ef8d642 2025-10-15)
binary: rustc
commit-hash: 57ef8d642d21965304bde849bab4f389b4353e27
commit-date: 2025-10-15
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.3
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 with the cargo dev rename_lint command and inspect its handling of clippy_lints/src/lib.rs. Reproduce the empty_enum to empty_enums rename and verify that the registered lint pass struct changes from EmptyEnum to EmptyEnums along with the module name.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.