rust-lang/rust-clippy

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

Open

#16,359 opened on 2026年1月8日

GitHub で見る
 (1 comment) (1 reaction) (1 assignee)Rust (1,391 forks)batch import
C-enhancementgood first issue

Repository metrics

Stars
 (10,406 stars)
PR merge metrics
 (平均マージ 19d 22h) (30d で 113 merged PRs)

説明

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

コントリビューターガイド