rust-lang/rust-clippy

Rewrite `arithmetic_side_effects` to not use matching on string representation of types

Open

#16.359 aperta il 8 gen 2026

Vedi su GitHub
 (1 commento) (1 reazione) (1 assegnatario)Rust (1391 fork)batch import
C-enhancementgood first issue

Metriche repository

Star
 (10.406 star)
Metriche merge PR
 (Merge medio 16g 6h) (79 PR mergiate in 30 g)

Descrizione

Description

arithmetic_side_effects uses the string representation of types to compare them. This will miss aliases (including core/allocstd), takes longer to compare, etc.

It should use a method similar to what is done in the disallowed_types lint, where maps of DefId or PrimTy are built at lint initialization time and then used throughout the tree walk. Some type lookup code could probably even be shared (including the part where unloaded crates don't cause errors).

Version

Additional Labels

No response

Guida contributor