We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
implicit_saturating_sub
1 parent cab5362 commit 0e07f55Copy full SHA for 0e07f55
clippy_lints/src/implicit_saturating_sub.rs
@@ -16,15 +16,21 @@ declare_clippy_lint! {
16
///
17
/// ### Example
18
/// ```rust
19
- /// # let mut i: u32 = 0;
+ /// # let end: u32 = 10;
20
+ /// # let start: u32 = 5;
21
+ /// let mut i: u32 = end - start;
22
+ ///
23
/// if i != 0 {
24
/// i -= 1;
25
/// }
26
/// ```
27
28
/// Use instead:
29
30
31
32
33
34
/// i = i.saturating_sub(1);
35
36
#[clippy::version = "1.44.0"]
0 commit comments