-
Notifications
You must be signed in to change notification settings - Fork 2k
Allow absolute_paths to be configured based on occurrence #16574
Copy link
Copy link
Open
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messages
Description
Description
I like the idea of absolute_paths but my heuristic I generally use is if something is used once or twice can remain as an absolute path.
Namely, support impls that are gated by #[cfg(feature = "")] impl MyCrateTrait for some::foreign::Type {}. Especially with a large workspace, specifying the allowed crate prefixes means that all occurrences of this type workspace-wide will now get excluded by the rule, or I have to do an #[expect()] attribute on all of them.
What I'd really like is to specify absolute-paths-max-occurrences = 2 in my clippy.toml to say "if this absolute path is used more than twice in a given file, it should trigger an absolute_paths warning".
Version
rustc 1.95.0-nightly (d940e5684 2026-01-19)
binary: rustc
commit-hash: d940e56841ddcc05671ead99290e35ff2e98369f
commit-date: 2026-01-19
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8
Additional Labels
@rustbot label +C-enhancement
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messages
Type
Fields
Give feedbackNo fields configured for issues without a type.