Skip to content

Commit

Permalink
Fix doctest and renaming src
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkuu committed Sep 4, 2019
1 parent 4960f79 commit 45fde0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod checked_arith_unwrap_or;
mod manual_saturating_arithmetic;
mod option_map_unwrap_or;
mod unnecessary_filter_map;

Expand Down Expand Up @@ -994,15 +994,17 @@ declare_clippy_lint! {
/// ```rust
/// let x: u32 = 100;
///
/// let add = x.checked_add(y).unwrap_or(u32::max_value());
/// let sub = x.checked_sub(y).unwrap_or(u32::min_value());
/// let add = x.checked_add(3).unwrap_or(u32::max_value());
/// let sub = x.checked_sub(3).unwrap_or(u32::min_value());
/// ```
///
/// can be written using dedicated methods for saturating addition/subtraction as:
///
/// ```rust
/// let add = x.saturating_add(y);
/// let sub = x.saturating_sub(y);
/// let x: u32 = 100;
///
/// let add = x.saturating_add(3);
/// let sub = x.saturating_sub(3);
/// ```
pub MANUAL_SATURATING_ARITHMETIC,
style,
Expand Down Expand Up @@ -1102,7 +1104,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
["unwrap_or", arith @ "checked_add"]
| ["unwrap_or", arith @ "checked_sub"]
| ["unwrap_or", arith @ "checked_mul"] => {
checked_arith_unwrap_or::lint(cx, expr, &arg_lists, &arith["checked_".len()..])
manual_saturating_arithmetic::lint(cx, expr, &arg_lists, &arith["checked_".len()..])
},
_ => {},
}
Expand Down

0 comments on commit 45fde0f

Please sign in to comment.