mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
Hide unnecessary code in [implicit_saturating_sub
]
This commit is contained in:
parent
cab5362d32
commit
0e07f55ceb
1 changed files with 8 additions and 2 deletions
|
@ -16,7 +16,10 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// ### Example
|
||||
/// ```rust
|
||||
/// # let mut i: u32 = 0;
|
||||
/// # let end: u32 = 10;
|
||||
/// # let start: u32 = 5;
|
||||
/// let mut i: u32 = end - start;
|
||||
///
|
||||
/// if i != 0 {
|
||||
/// i -= 1;
|
||||
/// }
|
||||
|
@ -24,7 +27,10 @@ declare_clippy_lint! {
|
|||
///
|
||||
/// Use instead:
|
||||
/// ```rust
|
||||
/// # let mut i: u32 = 0;
|
||||
/// # let end: u32 = 10;
|
||||
/// # let start: u32 = 5;
|
||||
/// let mut i: u32 = end - start;
|
||||
///
|
||||
/// i = i.saturating_sub(1);
|
||||
/// ```
|
||||
#[clippy::version = "1.44.0"]
|
||||
|
|
Loading…
Reference in a new issue