Skip to content

Commit 45fde0f

Browse files
committed
Fix doctest and renaming src
1 parent 4960f79 commit 45fde0f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mod checked_arith_unwrap_or;
1+
mod manual_saturating_arithmetic;
22
mod option_map_unwrap_or;
33
mod unnecessary_filter_map;
44

@@ -994,15 +994,17 @@ declare_clippy_lint! {
994994
/// ```rust
995995
/// let x: u32 = 100;
996996
///
997-
/// let add = x.checked_add(y).unwrap_or(u32::max_value());
998-
/// let sub = x.checked_sub(y).unwrap_or(u32::min_value());
997+
/// let add = x.checked_add(3).unwrap_or(u32::max_value());
998+
/// let sub = x.checked_sub(3).unwrap_or(u32::min_value());
999999
/// ```
10001000
///
10011001
/// can be written using dedicated methods for saturating addition/subtraction as:
10021002
///
10031003
/// ```rust
1004-
/// let add = x.saturating_add(y);
1005-
/// let sub = x.saturating_sub(y);
1004+
/// let x: u32 = 100;
1005+
///
1006+
/// let add = x.saturating_add(3);
1007+
/// let sub = x.saturating_sub(3);
10061008
/// ```
10071009
pub MANUAL_SATURATING_ARITHMETIC,
10081010
style,
@@ -1102,7 +1104,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
11021104
["unwrap_or", arith @ "checked_add"]
11031105
| ["unwrap_or", arith @ "checked_sub"]
11041106
| ["unwrap_or", arith @ "checked_mul"] => {
1105-
checked_arith_unwrap_or::lint(cx, expr, &arg_lists, &arith["checked_".len()..])
1107+
manual_saturating_arithmetic::lint(cx, expr, &arg_lists, &arith["checked_".len()..])
11061108
},
11071109
_ => {},
11081110
}

0 commit comments

Comments
 (0)