rust-lang/rust-clippy

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

Open

#16,359 创建于 2026年1月8日

在 GitHub 查看
 (1 评论) (1 反应) (1 负责人)Rust (1,391 fork)batch import
C-enhancementgood first issue

仓库指标

Star
 (10,406 star)
PR 合并指标
 (平均合并 19天 22小时) (30 天内合并 113 个 PR)

描述

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

贡献者指南