-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
A-documentationArea: Adding or improving documentationArea: Adding or improving documentationC-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
a % b == 0 is not equivalent to a.is_multiple_of(b): b == 0 panics in the former, while it may return false or true in the latter.
However, the Clippy lint manual_is_multiple_of does not mention this potential change in behavior -- the user may or may not want the non-panicking behavior.
Therefore, should manual_is_multiple_of mention that the replacement may change behavior in b == 0 cases?
Example: https://godbolt.org/z/4883fo71s
(This is very similar to #14333 about manual_div_ceil, but for manual_is_multiple_of.)
Version
rustc 1.88.0 (6b00bc388 2025-06-23)
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
A-documentationArea: Adding or improving documentationArea: Adding or improving documentationC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messages