v.checked_sub(1).unwrap_or(v) is also an implicit_saturating_sub #8215
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
Description
we already detect saturating_subs done one way:
https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/implicit_saturating_sub.rs
I came across someone doing it another way:
v.checked_sub(1).unwrap_or(v)
Thought it might be one to add into the logic. Maybe an easy one for a new person to hack on?
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: