]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/excessive_precision.rs
Merge branch 'macro-use' into HEAD
[rust.git] / clippy_lints / src / excessive_precision.rs
index c33a3b50185feb30f10d8193f423b1d55eac9ff6..28819077f9bc68f99f6d51288355fa5865e7a114 100644 (file)
@@ -1,5 +1,7 @@
 use rustc::hir;
 use rustc::lint::*;
+use rustc::{declare_lint, lint_array};
+use if_chain::if_chain;
 use rustc::ty::TypeVariants;
 use std::f32;
 use std::f64;
 ///
 /// ```rust
 /// // Bad
-/// Insert a short example of code that triggers the lint
 ///    let v: f32 = 0.123_456_789_9;
 ///    println!("{}", v); //  0.123_456_789
 ///
 /// // Good
-/// Insert a short example of improved code that doesn't trigger the lint
 ///    let v: f64 = 0.123_456_789_9;
 ///    println!("{}", v); //  0.123_456_789_9
 /// ```
@@ -47,7 +47,7 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr) {
         if_chain! {
             let ty = cx.tables.expr_ty(expr);
             if let TypeVariants::TyFloat(fty) = ty.sty;
-            if let hir::ExprLit(ref lit) = expr.node;
+            if let hir::ExprKind::Lit(ref lit) = expr.node;
             if let LitKind::Float(sym, _) | LitKind::FloatUnsuffixed(sym) = lit.node;
             if let Some(sugg) = self.check(sym, fty);
             then {