Merge pull request #2794 from mati865/rustup

 Update to nightly 2018-05-22 
diff --git a/build.rs b/build.rs
index 913f7b4..1481f46 100644
--- a/build.rs
+++ b/build.rs
@@ -13,12 +13,12 @@
 //! This build script was originally taken from the Rocket web framework:
 //! https://github.com/SergioBenitez/Rocket
 
-extern crate rustc_version;
 extern crate ansi_term;
+extern crate rustc_version;
 
-use std::env;
-use rustc_version::{version_meta, version_meta_for, Channel, Version, VersionMeta};
 use ansi_term::Colour::Red;
+use rustc_version::{version_meta, version_meta_for, Channel, Version, VersionMeta};
+use std::env;
 
 fn main() {
     check_rustc_version();
@@ -31,42 +31,48 @@
 
 fn check_rustc_version() {
     let string = include_str!("min_version.txt");
-    let min_version_meta = version_meta_for(string)
-        .expect("Could not parse version string in min_version.txt");
-    let current_version_meta = version_meta()
-        .expect("Could not retrieve current rustc version information from ENV");
+    let min_version_meta = version_meta_for(string).expect("Could not parse version string in min_version.txt");
+    let current_version_meta = version_meta().expect("Could not retrieve current rustc version information from ENV");
 
     let min_version = min_version_meta.clone().semver;
-    let min_date_str = min_version_meta.clone().commit_date
+    let min_date_str = min_version_meta
+        .clone()
+        .commit_date
         .expect("min_version.txt does not contain a rustc commit date");
 
     // Dev channel (rustc built from git) does not have any date or commit information in rustc -vV
     // `current_version_meta.commit_date` would crash, so we return early here.
     if current_version_meta.channel == Channel::Dev {
-        return
+        return;
     }
 
     let current_version = current_version_meta.clone().semver;
-    let current_date_str = current_version_meta.clone().commit_date
+    let current_date_str = current_version_meta
+        .clone()
+        .commit_date
         .expect("current rustc version information does not contain a rustc commit date");
 
     let print_version_err = |version: &Version, date: &str| {
-        eprintln!("> {} {}. {} {}.\n",
-                  "Installed rustc version is:",
-                  format!("{} ({})", version, date),
-                  "Minimum required rustc version:",
-                  format!("{} ({})", min_version, min_date_str));
+        eprintln!(
+            "> {} {}. {} {}.\n",
+            "Installed rustc version is:",
+            format!("{} ({})", version, date),
+            "Minimum required rustc version:",
+            format!("{} ({})", min_version, min_date_str)
+        );
     };
 
     if !correct_channel(&current_version_meta) {
-        eprintln!("\n{} {}",
-                  Red.bold().paint("error:"),
-                  "clippy requires a nightly version of Rust.");
+        eprintln!(
+            "\n{} {}",
+            Red.bold().paint("error:"),
+            "clippy requires a nightly version of Rust."
+        );
         print_version_err(&current_version, &*current_date_str);
-        eprintln!("{}{}{}",
-                  "See the README (",
-                  "https://github.com/rust-lang-nursery/rust-clippy#usage",
-                  ") for more information.");
+        eprintln!(
+            "{}{}{}",
+            "See the README (", "https://github.com/rust-lang-nursery/rust-clippy#usage", ") for more information."
+        );
         panic!("Aborting compilation due to incompatible compiler.")
     }
 
@@ -74,13 +80,15 @@
     let min_date = str_to_ymd(&min_date_str).unwrap();
 
     if current_date < min_date {
-        eprintln!("\n{} {}",
-                  Red.bold().paint("error:"),
-                  "clippy does not support this version of rustc nightly.");
-        eprintln!("> {}{}{}",
-                  "Use `",
-                  "rustup update",
-                  "` or your preferred method to update Rust.");
+        eprintln!(
+            "\n{} {}",
+            Red.bold().paint("error:"),
+            "clippy does not support this version of rustc nightly."
+        );
+        eprintln!(
+            "> {}{}{}",
+            "Use `", "rustup update", "` or your preferred method to update Rust."
+        );
         print_version_err(&current_version, &*current_date_str);
         panic!("Aborting compilation due to incompatible compiler.")
     }
@@ -88,12 +96,8 @@
 
 fn correct_channel(version_meta: &VersionMeta) -> bool {
     match version_meta.channel {
-        Channel::Stable | Channel::Beta => {
-            false
-        },
-        Channel::Nightly | Channel::Dev => {
-            true
-        }
+        Channel::Stable | Channel::Beta => false,
+        Channel::Nightly | Channel::Dev => true,
     }
 }
 
@@ -101,7 +105,7 @@
 fn str_to_ymd(ymd: &str) -> Option<u32> {
     let ymd: Vec<u32> = ymd.split("-").filter_map(|s| s.parse::<u32>().ok()).collect();
     if ymd.len() != 3 {
-        return None
+        return None;
     }
 
     let (y, m, d) = (ymd[0], ymd[1], ymd[2]);
diff --git a/clippy_lints/src/approx_const.rs b/clippy_lints/src/approx_const.rs
index d15b48c..20b9c27 100644
--- a/clippy_lints/src/approx_const.rs
+++ b/clippy_lints/src/approx_const.rs
@@ -1,5 +1,5 @@
-use rustc::lint::*;
 use rustc::hir::*;
+use rustc::lint::*;
 use std::f64::consts as f64;
 use syntax::ast::{FloatTy, Lit, LitKind};
 use syntax::symbol;
@@ -90,8 +90,7 @@
                     &format!(
                         "approximate value of `{}::consts::{}` found. \
                          Consider using it directly",
-                        module,
-                        &name
+                        module, &name
                     ),
                 );
                 return;
diff --git a/clippy_lints/src/arithmetic.rs b/clippy_lints/src/arithmetic.rs
index 501f493..835555f 100644
--- a/clippy_lints/src/arithmetic.rs
+++ b/clippy_lints/src/arithmetic.rs
@@ -57,19 +57,19 @@
         match expr.node {
             hir::ExprBinary(ref op, ref l, ref r) => {
                 match op.node {
-                    hir::BiAnd |
-                    hir::BiOr |
-                    hir::BiBitAnd |
-                    hir::BiBitOr |
-                    hir::BiBitXor |
-                    hir::BiShl |
-                    hir::BiShr |
-                    hir::BiEq |
-                    hir::BiLt |
-                    hir::BiLe |
-                    hir::BiNe |
-                    hir::BiGe |
-                    hir::BiGt => return,
+                    hir::BiAnd
+                    | hir::BiOr
+                    | hir::BiBitAnd
+                    | hir::BiBitOr
+                    | hir::BiBitXor
+                    | hir::BiShl
+                    | hir::BiShr
+                    | hir::BiEq
+                    | hir::BiLt
+                    | hir::BiLe
+                    | hir::BiNe
+                    | hir::BiGe
+                    | hir::BiGt => return,
                     _ => (),
                 }
                 let (l_ty, r_ty) = (cx.tables.expr_ty(l), cx.tables.expr_ty(r));
diff --git a/clippy_lints/src/array_indexing.rs b/clippy_lints/src/array_indexing.rs
index b5a42f0..010f07a 100644
--- a/clippy_lints/src/array_indexing.rs
+++ b/clippy_lints/src/array_indexing.rs
@@ -1,10 +1,10 @@
+use consts::{constant, Constant};
+use rustc::hir;
 use rustc::lint::*;
 use rustc::ty;
-use rustc::hir;
 use syntax::ast::RangeLimits;
-use utils::{self, higher};
 use utils::higher::Range;
-use consts::{constant, Constant};
+use utils::{self, higher};
 
 /// **What it does:** Checks for out of bounds array indexing with a constant
 /// index.
diff --git a/clippy_lints/src/assign_ops.rs b/clippy_lints/src/assign_ops.rs
index da4b0d6..fae2897 100644
--- a/clippy_lints/src/assign_ops.rs
+++ b/clippy_lints/src/assign_ops.rs
@@ -95,24 +95,28 @@
                                 MISREFACTORED_ASSIGN_OP,
                                 expr.span,
                                 "variable appears on both sides of an assignment operation",
-                                |db| if let (Some(snip_a), Some(snip_r)) =
-                                    (snippet_opt(cx, assignee.span), snippet_opt(cx, rhs_other.span))
-                                {
-                                    let a = &sugg::Sugg::hir(cx, assignee, "..");
-                                    let r = &sugg::Sugg::hir(cx, rhs, "..");
-                                    let long = format!("{} = {}", snip_a, sugg::make_binop(higher::binop(op.node), a, r));
-                                    db.span_suggestion(
-                                        expr.span,
-                                        &format!("Did you mean {} = {} {} {} or {}? Consider replacing it with",
-                                                 snip_a, snip_a, op.node.as_str(), snip_r,
-                                                 long),
-                                        format!("{} {}= {}", snip_a, op.node.as_str(), snip_r)
-                                    );
-                                    db.span_suggestion(
-                                        expr.span,
-                                        "or",
-                                        long
-                                    );
+                                |db| {
+                                    if let (Some(snip_a), Some(snip_r)) =
+                                        (snippet_opt(cx, assignee.span), snippet_opt(cx, rhs_other.span))
+                                    {
+                                        let a = &sugg::Sugg::hir(cx, assignee, "..");
+                                        let r = &sugg::Sugg::hir(cx, rhs, "..");
+                                        let long =
+                                            format!("{} = {}", snip_a, sugg::make_binop(higher::binop(op.node), a, r));
+                                        db.span_suggestion(
+                                            expr.span,
+                                            &format!(
+                                                "Did you mean {} = {} {} {} or {}? Consider replacing it with",
+                                                snip_a,
+                                                snip_a,
+                                                op.node.as_str(),
+                                                snip_r,
+                                                long
+                                            ),
+                                            format!("{} {}= {}", snip_a, op.node.as_str(), snip_r),
+                                        );
+                                        db.span_suggestion(expr.span, "or", long);
+                                    }
                                 },
                             );
                         };
@@ -170,7 +174,7 @@
                             op.node,
                             cx,
                             ty,
-                            rty,
+                            rty.into(),
                             Add: BiAdd,
                             Sub: BiSub,
                             Mul: BiMul,
@@ -189,14 +193,16 @@
                                 ASSIGN_OP_PATTERN,
                                 expr.span,
                                 "manual implementation of an assign operation",
-                                |db| if let (Some(snip_a), Some(snip_r)) =
-                                    (snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span))
-                                {
-                                    db.span_suggestion(
-                                        expr.span,
-                                        "replace it with",
-                                        format!("{} {}= {}", snip_a, op.node.as_str(), snip_r),
-                                    );
+                                |db| {
+                                    if let (Some(snip_a), Some(snip_r)) =
+                                        (snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span))
+                                    {
+                                        db.span_suggestion(
+                                            expr.span,
+                                            "replace it with",
+                                            format!("{} {}= {}", snip_a, op.node.as_str(), snip_r),
+                                        );
+                                    }
                                 },
                             );
                         }
@@ -205,7 +211,7 @@
                     let mut visitor = ExprVisitor {
                         assignee,
                         counter: 0,
-                        cx
+                        cx,
                     };
 
                     walk_expr(&mut visitor, e);
@@ -218,13 +224,13 @@
                         // a = b commutative_op a
                         if SpanlessEq::new(cx).ignore_fn().eq_expr(assignee, r) {
                             match op.node {
-                                hir::BiAdd |
-                                hir::BiMul |
-                                hir::BiAnd |
-                                hir::BiOr |
-                                hir::BiBitXor |
-                                hir::BiBitAnd |
-                                hir::BiBitOr => {
+                                hir::BiAdd
+                                | hir::BiMul
+                                | hir::BiAnd
+                                | hir::BiOr
+                                | hir::BiBitXor
+                                | hir::BiBitAnd
+                                | hir::BiBitOr => {
                                     lint(assignee, l);
                                 },
                                 _ => {},
diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs
index b1cd096..936b5e7 100644
--- a/clippy_lints/src/attrs.rs
+++ b/clippy_lints/src/attrs.rs
@@ -1,13 +1,16 @@
 //! checks for attributes
 
 use reexport::*;
-use rustc::lint::*;
 use rustc::hir::*;
+use rustc::lint::*;
 use rustc::ty::{self, TyCtxt};
 use semver::Version;
-use syntax::ast::{Attribute, AttrStyle, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
+use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
 use syntax::codemap::Span;
-use utils::{in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_then, without_block_comments};
+use utils::{
+    in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_then,
+    without_block_comments,
+};
 
 /// **What it does:** Checks for items annotated with `#[inline(always)]`,
 /// unless the annotated function is empty or simply panics.
@@ -118,7 +121,12 @@
 
 impl LintPass for AttrPass {
     fn get_lints(&self) -> LintArray {
-        lint_array!(INLINE_ALWAYS, DEPRECATED_SEMVER, USELESS_ATTRIBUTE, EMPTY_LINE_AFTER_OUTER_ATTR)
+        lint_array!(
+            INLINE_ALWAYS,
+            DEPRECATED_SEMVER,
+            USELESS_ATTRIBUTE,
+            EMPTY_LINE_AFTER_OUTER_ATTR
+        )
     }
 }
 
@@ -170,11 +178,7 @@
                                             "useless lint attribute",
                                             |db| {
                                                 sugg = sugg.replacen("#[", "#![", 1);
-                                                db.span_suggestion(
-                                                    line_span,
-                                                    "if you just forgot a `!`, use",
-                                                    sugg,
-                                                );
+                                                db.span_suggestion(line_span, "if you just forgot a `!`, use", sugg);
                                             },
                                         );
                                     }
@@ -234,10 +238,7 @@
             StmtExpr(ref expr, _) | StmtSemi(ref expr, _) => is_relevant_expr(tcx, tables, expr),
         }
     } else {
-        block
-            .expr
-            .as_ref()
-            .map_or(false, |e| is_relevant_expr(tcx, tables, e))
+        block.expr.as_ref().map_or(false, |e| is_relevant_expr(tcx, tables, e))
     }
 }
 
diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs
index 841c617..3e803c1 100644
--- a/clippy_lints/src/consts.rs
+++ b/clippy_lints/src/consts.rs
@@ -429,9 +429,9 @@
             ty::TyRef(_, tam, _) => match tam.sty {
                 ty::TyStr => {
                     let alloc = tcx
-                        .interpret_interner
-                        .get_alloc(ptr.alloc_id)
-                        .unwrap();
+                        .alloc_map
+                        .lock()
+                        .unwrap_memory(ptr.alloc_id);
                     let offset = ptr.offset.bytes() as usize;
                     let n = n as usize;
                     String::from_utf8(alloc.bytes[offset..(offset + n)].to_owned()).ok().map(Constant::Str)
diff --git a/clippy_lints/src/enum_clike.rs b/clippy_lints/src/enum_clike.rs
index da3586a..37c0e1e 100644
--- a/clippy_lints/src/enum_clike.rs
+++ b/clippy_lints/src/enum_clike.rs
@@ -50,9 +50,9 @@
         if let ItemEnum(ref def, _) = item.node {
             for var in &def.variants {
                 let variant = &var.node;
-                if let Some(body_id) = variant.disr_expr {
+                if let Some(ref anon_const) = variant.disr_expr {
                     let param_env = ty::ParamEnv::empty();
-                    let did = cx.tcx.hir.body_owner_def_id(body_id);
+                    let did = cx.tcx.hir.body_owner_def_id(anon_const.body);
                     let substs = Substs::identity_for_item(cx.tcx.global_tcx(), did);
                     let instance = ty::Instance::new(did, substs);
                     let cid = GlobalId {
diff --git a/clippy_lints/src/eq_op.rs b/clippy_lints/src/eq_op.rs
index cce20a5..ca441aa 100644
--- a/clippy_lints/src/eq_op.rs
+++ b/clippy_lints/src/eq_op.rs
@@ -90,7 +90,7 @@
                         let lcpy = is_copy(cx, lty);
                         let rcpy = is_copy(cx, rty);
                         // either operator autorefs or both args are copyable
-                        if (requires_ref || (lcpy && rcpy)) && implements_trait(cx, lty, trait_id, &[rty]) {
+                        if (requires_ref || (lcpy && rcpy)) && implements_trait(cx, lty, trait_id, &[rty.into()]) {
                             span_lint_and_then(
                                 cx,
                                 OP_REF,
@@ -106,12 +106,12 @@
                                     );
                                 },
                             )
-                        } else if lcpy && !rcpy && implements_trait(cx, lty, trait_id, &[cx.tables.expr_ty(right)]) {
+                        } else if lcpy && !rcpy && implements_trait(cx, lty, trait_id, &[cx.tables.expr_ty(right).into()]) {
                             span_lint_and_then(cx, OP_REF, e.span, "needlessly taken reference of left operand", |db| {
                                 let lsnip = snippet(cx, l.span, "...").to_string();
                                 db.span_suggestion(left.span, "use the left value directly", lsnip);
                             })
-                        } else if !lcpy && rcpy && implements_trait(cx, cx.tables.expr_ty(left), trait_id, &[rty]) {
+                        } else if !lcpy && rcpy && implements_trait(cx, cx.tables.expr_ty(left), trait_id, &[rty.into()]) {
                             span_lint_and_then(
                                 cx,
                                 OP_REF,
@@ -128,7 +128,7 @@
                     (&ExprAddrOf(_, ref l), _) => {
                         let lty = cx.tables.expr_ty(l);
                         let lcpy = is_copy(cx, lty);
-                        if (requires_ref || lcpy) && implements_trait(cx, lty, trait_id, &[cx.tables.expr_ty(right)]) {
+                        if (requires_ref || lcpy) && implements_trait(cx, lty, trait_id, &[cx.tables.expr_ty(right).into()]) {
                             span_lint_and_then(cx, OP_REF, e.span, "needlessly taken reference of left operand", |db| {
                                 let lsnip = snippet(cx, l.span, "...").to_string();
                                 db.span_suggestion(left.span, "use the left value directly", lsnip);
@@ -139,7 +139,7 @@
                     (_, &ExprAddrOf(_, ref r)) => {
                         let rty = cx.tables.expr_ty(r);
                         let rcpy = is_copy(cx, rty);
-                        if (requires_ref || rcpy) && implements_trait(cx, cx.tables.expr_ty(left), trait_id, &[rty]) {
+                        if (requires_ref || rcpy) && implements_trait(cx, cx.tables.expr_ty(left), trait_id, &[rty.into()]) {
                             span_lint_and_then(cx, OP_REF, e.span, "taken reference of right operand", |db| {
                                 let rsnip = snippet(cx, r.span, "...").to_string();
                                 db.span_suggestion(right.span, "use the right value directly", rsnip);
diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs
index 0ecd0ac..080a271 100644
--- a/clippy_lints/src/misc.rs
+++ b/clippy_lints/src/misc.rs
@@ -495,13 +495,13 @@
     // *arg impls PartialEq<other>
     if !arg_ty
         .builtin_deref(true)
-        .map_or(false, |tam| implements_trait(cx, tam.ty, partial_eq_trait_id, &[other_ty]))
+        .map_or(false, |tam| implements_trait(cx, tam.ty, partial_eq_trait_id, &[other_ty.into()]))
         // arg impls PartialEq<*other>
         && !other_ty
         .builtin_deref(true)
-        .map_or(false, |tam| implements_trait(cx, arg_ty, partial_eq_trait_id, &[tam.ty]))
+        .map_or(false, |tam| implements_trait(cx, arg_ty, partial_eq_trait_id, &[tam.ty.into()]))
         // arg impls PartialEq<other>
-        && !implements_trait(cx, arg_ty, partial_eq_trait_id, &[other_ty])
+        && !implements_trait(cx, arg_ty, partial_eq_trait_id, &[other_ty.into()])
     {
         return;
     }
diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs
index 5108540..907f9cb 100644
--- a/clippy_lints/src/needless_pass_by_value.rs
+++ b/clippy_lints/src/needless_pass_by_value.rs
@@ -175,7 +175,11 @@
                             cx,
                             cx.tcx.mk_imm_ref(&RegionKind::ReErased, ty),
                             t.def_id(),
-                            &t.skip_binder().input_types().skip(1).collect::<Vec<_>>(),
+                            &t.skip_binder()
+                                .input_types()
+                                .skip(1)
+                                .map(|ty| ty.into())
+                                .collect::<Vec<_>>(),
                         )
                     }),
                 )
diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs
index 7bdeb0a..05a6650 100644
--- a/clippy_lints/src/shadow.rs
+++ b/clippy_lints/src/shadow.rs
@@ -348,15 +348,15 @@
 fn check_ty<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: &'tcx Ty, bindings: &mut Vec<(Name, Span)>) {
     match ty.node {
         TySlice(ref sty) => check_ty(cx, sty, bindings),
-        TyArray(ref fty, body_id) => {
+        TyArray(ref fty, ref anon_const) => {
             check_ty(cx, fty, bindings);
-            check_expr(cx, &cx.tcx.hir.body(body_id).value, bindings);
+            check_expr(cx, &cx.tcx.hir.body(anon_const.body).value, bindings);
         },
         TyPtr(MutTy { ty: ref mty, .. }) | TyRptr(_, MutTy { ty: ref mty, .. }) => check_ty(cx, mty, bindings),
         TyTup(ref tup) => for t in tup {
             check_ty(cx, t, bindings)
         },
-        TyTypeof(body_id) => check_expr(cx, &cx.tcx.hir.body(body_id).value, bindings),
+        TyTypeof(ref anon_const) => check_expr(cx, &cx.tcx.hir.body(anon_const.body).value, bindings),
         _ => (),
     }
 }
diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs
index 7d9945c..deaa796 100644
--- a/clippy_lints/src/utils/hir_utils.rs
+++ b/clippy_lints/src/utils/hir_utils.rs
@@ -120,11 +120,11 @@
             (&ExprMethodCall(ref l_path, _, ref l_args), &ExprMethodCall(ref r_path, _, ref r_args)) => {
                 !self.ignore_fn && l_path == r_path && self.eq_exprs(l_args, r_args)
             },
-            (&ExprRepeat(ref le, ll_id), &ExprRepeat(ref re, rl_id)) => {
-                let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(ll_id));
-                let ll = celcx.expr(&self.cx.tcx.hir.body(ll_id).value);
-                let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(rl_id));
-                let rl = celcx.expr(&self.cx.tcx.hir.body(rl_id).value);
+            (&ExprRepeat(ref le, ref ll_id), &ExprRepeat(ref re, ref rl_id)) => {
+                let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(ll_id.body));
+                let ll = celcx.expr(&self.cx.tcx.hir.body(ll_id.body).value);
+                let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(rl_id.body));
+                let rl = celcx.expr(&self.cx.tcx.hir.body(rl_id.body).value);
 
                 self.eq_expr(le, re) && ll == rl
             },
@@ -234,16 +234,16 @@
     fn eq_ty(&mut self, left: &Ty, right: &Ty) -> bool {
         match (&left.node, &right.node) {
             (&TySlice(ref l_vec), &TySlice(ref r_vec)) => self.eq_ty(l_vec, r_vec),
-            (&TyArray(ref lt, ll_id), &TyArray(ref rt, rl_id)) => {
+            (&TyArray(ref lt, ref ll_id), &TyArray(ref rt, ref rl_id)) => {
                 let full_table = self.tables;
 
-                let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(ll_id));
-                self.tables = self.cx.tcx.body_tables(ll_id);
-                let ll = celcx.expr(&self.cx.tcx.hir.body(ll_id).value);
+                let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(ll_id.body));
+                self.tables = self.cx.tcx.body_tables(ll_id.body);
+                let ll = celcx.expr(&self.cx.tcx.hir.body(ll_id.body).value);
 
-                let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(rl_id));
-                self.tables = self.cx.tcx.body_tables(rl_id);
-                let rl = celcx.expr(&self.cx.tcx.hir.body(rl_id).value);
+                let mut celcx = constant_context(self.cx, self.cx.tcx.body_tables(rl_id.body));
+                self.tables = self.cx.tcx.body_tables(rl_id.body);
+                let rl = celcx.expr(&self.cx.tcx.hir.body(rl_id.body).value);
 
                 let eq_ty = self.eq_ty(lt, rt);
                 self.tables = full_table;
@@ -474,13 +474,13 @@
                 self.hash_name(&path.name);
                 self.hash_exprs(args);
             },
-            ExprRepeat(ref e, l_id) => {
+            ExprRepeat(ref e, ref l_id) => {
                 let c: fn(_, _) -> _ = ExprRepeat;
                 c.hash(&mut self.s);
                 self.hash_expr(e);
                 let full_table = self.tables;
-                self.tables = self.cx.tcx.body_tables(l_id);
-                self.hash_expr(&self.cx.tcx.hir.body(l_id).value);
+                self.tables = self.cx.tcx.body_tables(l_id.body);
+                self.hash_expr(&self.cx.tcx.hir.body(l_id.body).value);
                 self.tables = full_table;
             },
             ExprRet(ref e) => {
diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs
index 10a9a3a..6c3d8bc 100644
--- a/clippy_lints/src/utils/inspector.rs
+++ b/clippy_lints/src/utils/inspector.rs
@@ -330,12 +330,12 @@
                 print_expr(cx, base, indent + 1);
             }
         },
-        hir::ExprRepeat(ref val, body_id) => {
+        hir::ExprRepeat(ref val, ref anon_const) => {
             println!("{}Repeat", ind);
             println!("{}value:", ind);
             print_expr(cx, val, indent + 1);
             println!("{}repeat count:", ind);
-            print_expr(cx, &cx.tcx.hir.body(body_id).value, indent + 1);
+            print_expr(cx, &cx.tcx.hir.body(anon_const.body).value, indent + 1);
         },
     }
 }
diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs
index d5c7796..86af4e8 100644
--- a/clippy_lints/src/utils/mod.rs
+++ b/clippy_lints/src/utils/mod.rs
@@ -8,7 +8,7 @@
 use rustc::lint::{LateContext, Level, Lint, LintContext};
 use rustc::session::Session;
 use rustc::traits;
-use rustc::ty::{self, Ty, TyCtxt, layout::{self, IntegerExt}};
+use rustc::ty::{self, Ty, TyCtxt, layout::{self, IntegerExt}, subst::Kind};
 use rustc_errors::{Applicability, CodeSuggestion, Substitution, SubstitutionPart};
 use std::borrow::Cow;
 use std::env;
@@ -295,7 +295,7 @@
     cx: &LateContext<'a, 'tcx>,
     ty: Ty<'tcx>,
     trait_id: DefId,
-    ty_params: &[Ty<'tcx>],
+    ty_params: &[Kind<'tcx>],
 ) -> bool {
     let ty = cx.tcx.erase_regions(&ty);
     let obligation =
diff --git a/src/driver.rs b/src/driver.rs
index 61afb6e..a88d6e5 100644
--- a/src/driver.rs
+++ b/src/driver.rs
@@ -6,16 +6,16 @@
 extern crate clippy_lints;
 extern crate getopts;
 extern crate rustc;
+extern crate rustc_codegen_utils;
 extern crate rustc_driver;
 extern crate rustc_errors;
 extern crate rustc_plugin;
-extern crate rustc_codegen_utils;
 extern crate syntax;
 
-use rustc_driver::{driver, Compilation, CompilerCalls, RustcDefaultCalls};
-use rustc_codegen_utils::codegen_backend::CodegenBackend;
-use rustc::session::{config, Session};
 use rustc::session::config::{ErrorOutputType, Input};
+use rustc::session::{config, Session};
+use rustc_codegen_utils::codegen_backend::CodegenBackend;
+use rustc_driver::{driver, Compilation, CompilerCalls, RustcDefaultCalls};
 use std::path::PathBuf;
 use std::process::Command;
 use syntax::ast;
@@ -43,8 +43,7 @@
         descriptions: &rustc_errors::registry::Registry,
         output: ErrorOutputType,
     ) -> Compilation {
-        self.default
-            .early_callback(matches, sopts, cfg, descriptions, output)
+        self.default.early_callback(matches, sopts, cfg, descriptions, output)
     }
     fn no_input(
         &mut self,
@@ -55,8 +54,7 @@
         ofile: &Option<PathBuf>,
         descriptions: &rustc_errors::registry::Registry,
     ) -> Option<(Input, Option<PathBuf>)> {
-        self.default
-            .no_input(matches, sopts, cfg, odir, ofile, descriptions)
+        self.default.no_input(matches, sopts, cfg, odir, ofile, descriptions)
     }
     fn late_callback(
         &mut self,
@@ -118,7 +116,7 @@
                 }
                 old(state);
             });
-            
+
             control.compilation_done.stop = Compilation::Stop;
         }
 
@@ -185,15 +183,18 @@
     // this check ensures that dependencies are built but not linted and the final
     // crate is
     // linted but not built
-    let clippy_enabled = env::var("CLIPPY_TESTS")
-        .ok()
-        .map_or(false, |val| val == "true")
+    let clippy_enabled = env::var("CLIPPY_TESTS").ok().map_or(false, |val| val == "true")
         || orig_args.iter().any(|s| s == "--emit=dep-info,metadata");
 
     if clippy_enabled {
         args.extend_from_slice(&["--cfg".to_owned(), r#"feature="cargo-clippy""#.to_owned()]);
         if let Ok(extra_args) = env::var("CLIPPY_ARGS") {
-            args.extend(extra_args.split("__CLIPPY_HACKERY__").filter(|s| !s.is_empty()).map(str::to_owned));
+            args.extend(
+                extra_args
+                    .split("__CLIPPY_HACKERY__")
+                    .filter(|s| !s.is_empty())
+                    .map(str::to_owned),
+            );
         }
     }
 
diff --git a/src/lib.rs b/src/lib.rs
index e693232..193be97 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,7 +15,9 @@
     reg.sess.lint_store.with_read_lock(|lint_store| {
         for (lint, _, _) in lint_store.get_lint_groups() {
             reg.sess
-                .struct_warn("the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature")
+                .struct_warn(
+                    "the clippy plugin is being deprecated, please use cargo clippy or rls with the clippy feature",
+                )
                 .emit();
             if lint == "clippy" {
                 // cargo clippy run on a crate that also uses the plugin
diff --git a/tests/compile-test.rs b/tests/compile-test.rs
index 9b9820f..b965dce 100644
--- a/tests/compile-test.rs
+++ b/tests/compile-test.rs
@@ -3,8 +3,8 @@
 extern crate compiletest_rs as compiletest;
 extern crate test;
 
-use std::path::{Path, PathBuf};
 use std::env::{set_var, var};
+use std::path::{Path, PathBuf};
 
 fn clippy_driver_path() -> PathBuf {
     if let Some(path) = option_env!("CLIPPY_DRIVER_PATH") {
@@ -43,10 +43,7 @@
         config.run_lib_path = rustc_lib_path();
         config.compile_lib_path = rustc_lib_path();
     }
-    config.target_rustcflags = Some(format!(
-        "-L {0} -L {0}/deps -Dwarnings",
-        host_libs().display()
-    ));
+    config.target_rustcflags = Some(format!("-L {0} -L {0}/deps -Dwarnings", host_libs().display()));
 
     config.mode = cfg_mode;
     config.build_base = if rustc_test_suite().is_some() {
diff --git a/tests/versioncheck.rs b/tests/versioncheck.rs
index ff4af08..25b0cee 100644
--- a/tests/versioncheck.rs
+++ b/tests/versioncheck.rs
@@ -7,10 +7,7 @@
     let clippy_meta = cargo_metadata::metadata(None).expect("could not obtain cargo metadata");
     std::env::set_current_dir(std::env::current_dir().unwrap().join("clippy_lints")).unwrap();
     let clippy_lints_meta = cargo_metadata::metadata(None).expect("could not obtain cargo metadata");
-    assert_eq!(
-        clippy_lints_meta.packages[0].version,
-        clippy_meta.packages[0].version
-    );
+    assert_eq!(clippy_lints_meta.packages[0].version, clippy_meta.packages[0].version);
     for package in &clippy_meta.packages[0].dependencies {
         if package.name == "clippy_lints" {
             assert_eq!(
diff --git a/tests/without_block_comments.rs b/tests/without_block_comments.rs
index 375df05..730c5cb 100644
--- a/tests/without_block_comments.rs
+++ b/tests/without_block_comments.rs
@@ -7,9 +7,7 @@
     println!("result: {:?}", result);
     assert!(result.is_empty());
 
-    let result = without_block_comments(
-        vec!["", "/*", "", "*/", "#[crate_type = \"lib\"]", "/*", "", "*/", ""]
-    );
+    let result = without_block_comments(vec!["", "/*", "", "*/", "#[crate_type = \"lib\"]", "/*", "", "*/", ""]);
     assert_eq!(result, vec!["", "#[crate_type = \"lib\"]", ""]);
 
     let result = without_block_comments(vec!["/* rust", "", "*/"]);
@@ -18,7 +16,7 @@
     let result = without_block_comments(vec!["/* one-line comment */"]);
     assert!(result.is_empty());
 
-    let result = without_block_comments(vec!["/* nested", "/* multi-line",  "comment",  "*/", "test", "*/"]);
+    let result = without_block_comments(vec!["/* nested", "/* multi-line", "comment", "*/", "test", "*/"]);
     assert!(result.is_empty());
 
     let result = without_block_comments(vec!["/* nested /* inline /* comment */ test */ */"]);