]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/overflow_check_conditional.rs
Auto merge of #3946 - rchaser53:issue-3920, r=flip1995
[rust.git] / clippy_lints / src / overflow_check_conditional.rs
index d76a9f96eff8644588768e23bdab6dbdeae2b904..c041f3a959a021a6d8a5f479c2b3b323e767d193 100644 (file)
@@ -4,18 +4,18 @@
 use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::{declare_tool_lint, lint_array};
 
-/// **What it does:** Detects classic underflow/overflow checks.
-///
-/// **Why is this bad?** Most classic C underflow/overflow checks will fail in
-/// Rust. Users can use functions like `overflowing_*` and `wrapping_*` instead.
-///
-/// **Known problems:** None.
-///
-/// **Example:**
-/// ```rust
-/// a + b < a
-/// ```
 declare_clippy_lint! {
+    /// **What it does:** Detects classic underflow/overflow checks.
+    ///
+    /// **Why is this bad?** Most classic C underflow/overflow checks will fail in
+    /// Rust. Users can use functions like `overflowing_*` and `wrapping_*` instead.
+    ///
+    /// **Known problems:** None.
+    ///
+    /// **Example:**
+    /// ```rust
+    /// a + b < a
+    /// ```
     pub OVERFLOW_CHECK_CONDITIONAL,
     complexity,
     "overflow checks inspired by C which are likely to panic"
@@ -28,6 +28,10 @@ impl LintPass for OverflowCheckConditional {
     fn get_lints(&self) -> LintArray {
         lint_array!(OVERFLOW_CHECK_CONDITIONAL)
     }
+
+    fn name(&self) -> &'static str {
+        "OverflowCheckConditional"
+    }
 }
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OverflowCheckConditional {