mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-16 05:58:41 +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
|
/// ### Example
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # let mut i: u32 = 0;
|
/// # let end: u32 = 10;
|
||||||
|
/// # let start: u32 = 5;
|
||||||
|
/// let mut i: u32 = end - start;
|
||||||
|
///
|
||||||
/// if i != 0 {
|
/// if i != 0 {
|
||||||
/// i -= 1;
|
/// i -= 1;
|
||||||
/// }
|
/// }
|
||||||
|
@ -24,7 +27,10 @@ declare_clippy_lint! {
|
||||||
///
|
///
|
||||||
/// Use instead:
|
/// Use instead:
|
||||||
/// ```rust
|
/// ```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);
|
/// i = i.saturating_sub(1);
|
||||||
/// ```
|
/// ```
|
||||||
#[clippy::version = "1.44.0"]
|
#[clippy::version = "1.44.0"]
|
||||||
|
|
Loading…
Add table
Reference in a new issue