]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/misc.rs
Auto merge of #4809 - iankronquist:patch-1, r=flip1995
[rust.git] / clippy_lints / src / misc.rs
index 202fb4cdcf7fefb9393c540167041f93c0234f02..583bdd43df8325ace4c274fd7acd22e84080e6b1 100644 (file)
@@ -1,12 +1,11 @@
 use if_chain::if_chain;
 use matches::matches;
-use rustc::declare_lint_pass;
-use rustc::hir::intravisit::FnKind;
-use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
 use rustc::ty;
 use rustc_errors::Applicability;
+use rustc_hir::intravisit::FnKind;
 use rustc_hir::*;
-use rustc_session::declare_tool_lint;
+use rustc_lint::{LateContext, LateLintPass};
+use rustc_session::{declare_lint_pass, declare_tool_lint};
 use rustc_span::source_map::{ExpnKind, Span};
 use syntax::ast::LitKind;
 
@@ -63,7 +62,7 @@
     /// ```
     pub CMP_NAN,
     correctness,
-    "comparisons to NAN, which will always return false, probably not intended"
+    "comparisons to `NAN`, which will always return false, probably not intended"
 }
 
 declare_clippy_lint! {
     /// ```
     pub ZERO_PTR,
     style,
-    "using 0 as *{const, mut} T"
+    "using `0 as *{const, mut} T`"
 }
 
 declare_clippy_lint! {
@@ -370,9 +369,9 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
                         }
                     }
                     let (lint, msg) = if is_named_constant(cx, left) || is_named_constant(cx, right) {
-                        (FLOAT_CMP_CONST, "strict comparison of f32 or f64 constant")
+                        (FLOAT_CMP_CONST, "strict comparison of `f32` or `f64` constant")
                     } else {
-                        (FLOAT_CMP, "strict comparison of f32 or f64")
+                        (FLOAT_CMP, "strict comparison of `f32` or `f64`")
                     };
                     span_lint_and_then(cx, lint, expr.span, msg, |db| {
                         let lhs = Sugg::hir(cx, left, "..");
@@ -388,7 +387,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'_>) {
                             ),
                             Applicability::HasPlaceholders, // snippet
                         );
-                        db.span_note(expr.span, "std::f32::EPSILON and std::f64::EPSILON are available.");
+                        db.span_note(expr.span, "`std::f32::EPSILON` and `std::f64::EPSILON` are available.");
                     });
                 } else if op == BinOpKind::Rem && is_integer_const(cx, right, 1) {
                     span_lint(cx, MODULO_ONE, expr.span, "any number modulo 1 will be 0");
@@ -456,7 +455,7 @@ fn check_nan(cx: &LateContext<'_, '_>, expr: &Expr<'_>, cmp_expr: &Expr<'_>) {
                     cx,
                     CMP_NAN,
                     cmp_expr.span,
-                    "doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead",
+                    "doomed comparison with `NAN`, use `std::{f32,f64}::is_nan()` instead",
                 );
             }
         }