about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/hir/intravisit.rs8
-rw-r--r--src/librustc/hir/lowering.rs20
-rw-r--r--src/librustc/middle/liveness.rs38
-rw-r--r--src/librustc/middle/reachable.rs19
-rw-r--r--src/librustc/middle/resolve_lifetime.rs4
-rw-r--r--src/librustc_lint/types.rs7
-rw-r--r--src/librustc_lint/unused.rs19
-rw-r--r--src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs10
-rw-r--r--src/librustc_mir/hair/cx/expr.rs4
-rw-r--r--src/librustc_privacy/lib.rs15
-rw-r--r--src/librustc_typeck/check/demand.rs3
-rw-r--r--src/librustc_typeck/check/method/suggest.rs4
-rw-r--r--src/librustc_typeck/check/op.rs11
-rw-r--r--src/librustc_typeck/check/writeback.rs3
-rw-r--r--src/librustc_typeck/collect.rs8
15 files changed, 131 insertions, 42 deletions
diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs
index 8827576cd9c..2fefd2b3318 100644
--- a/src/librustc/hir/intravisit.rs
+++ b/src/librustc/hir/intravisit.rs
@@ -519,7 +519,13 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
             // visit_enum_def() takes care of visiting the Item's NodeId
             visitor.visit_enum_def(enum_definition, type_parameters, item.id, item.span)
         }
-        ItemKind::Impl(.., ref type_parameters, ref opt_trait_reference, ref typ, ref impl_item_refs) => {
+        ItemKind::Impl(
+            ..,
+            ref type_parameters,
+            ref opt_trait_reference,
+            ref typ,
+            ref impl_item_refs
+        ) => {
             visitor.visit_id(item.id);
             visitor.visit_generics(type_parameters);
             walk_list!(visitor, visit_trait_ref, opt_trait_reference);
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 31484f33732..722934ac39a 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -3877,7 +3877,9 @@ impl<'a> LoweringContext<'a> {
                 let expr = opt_expr
                     .as_ref()
                     .map(|x| self.lower_expr(x))
-                    .unwrap_or_else(|| self.expr(e.span, hir::ExprKind::Tup(hir_vec![]), ThinVec::new()));
+                    .unwrap_or_else(||
+                    self.expr(e.span, hir::ExprKind::Tup(hir_vec![]), ThinVec::new())
+                );
                 hir::ExprKind::Yield(P(expr))
             }
 
@@ -4053,11 +4055,18 @@ impl<'a> LoweringContext<'a> {
 
                     P(self.expr(
                         head_sp,
-                        hir::ExprKind::Match(next_expr, arms, hir::MatchSource::ForLoopDesugar),
+                        hir::ExprKind::Match(
+                            next_expr,
+                            arms,
+                            hir::MatchSource::ForLoopDesugar
+                        ),
                         ThinVec::new(),
                     ))
                 };
-                let match_stmt = respan(head_sp, hir::StmtKind::Expr(match_expr, self.next_id().node_id));
+                let match_stmt = respan(
+                    head_sp,
+                    hir::StmtKind::Expr(match_expr, self.next_id().node_id)
+                );
 
                 let next_expr = P(self.expr_ident(head_sp, next_ident, next_pat.id));
 
@@ -4076,7 +4085,10 @@ impl<'a> LoweringContext<'a> {
 
                 let body_block = self.with_loop_scope(e.id, |this| this.lower_block(body, false));
                 let body_expr = P(self.expr_block(body_block, ThinVec::new()));
-                let body_stmt = respan(body.span, hir::StmtKind::Expr(body_expr, self.next_id().node_id));
+                let body_stmt = respan(
+                    body.span,
+                    hir::StmtKind::Expr(body_expr, self.next_id().node_id)
+                );
 
                 let loop_block = P(self.block_all(
                     e.span,
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index dddb7a0c38f..b828b1bd30a 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -486,7 +486,10 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) {
       }
 
       // live nodes required for interesting control flow:
-      hir::ExprKind::If(..) | hir::ExprKind::Match(..) | hir::ExprKind::While(..) | hir::ExprKind::Loop(..) => {
+      hir::ExprKind::If(..) |
+      hir::ExprKind::Match(..) |
+      hir::ExprKind::While(..) |
+      hir::ExprKind::Loop(..) => {
         ir.add_live_node_for_node(expr.hir_id, ExprNode(expr.span));
         intravisit::walk_expr(ir, expr);
       }
@@ -496,15 +499,30 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) {
       }
 
       // otherwise, live nodes are not required:
-      hir::ExprKind::Index(..) | hir::ExprKind::Field(..) |
-      hir::ExprKind::Array(..) | hir::ExprKind::Call(..) | hir::ExprKind::MethodCall(..) |
-      hir::ExprKind::Tup(..) | hir::ExprKind::Binary(..) | hir::ExprKind::AddrOf(..) |
-      hir::ExprKind::Cast(..) | hir::ExprKind::Unary(..) | hir::ExprKind::Break(..) |
-      hir::ExprKind::Continue(_) | hir::ExprKind::Lit(_) | hir::ExprKind::Ret(..) |
-      hir::ExprKind::Block(..) | hir::ExprKind::Assign(..) | hir::ExprKind::AssignOp(..) |
-      hir::ExprKind::Struct(..) | hir::ExprKind::Repeat(..) |
-      hir::ExprKind::InlineAsm(..) | hir::ExprKind::Box(..) | hir::ExprKind::Yield(..) |
-      hir::ExprKind::Type(..) | hir::ExprKind::Path(hir::QPath::TypeRelative(..)) => {
+      hir::ExprKind::Index(..) |
+      hir::ExprKind::Field(..) |
+      hir::ExprKind::Array(..) |
+      hir::ExprKind::Call(..) |
+      hir::ExprKind::MethodCall(..) |
+      hir::ExprKind::Tup(..) |
+      hir::ExprKind::Binary(..) |
+      hir::ExprKind::AddrOf(..) |
+      hir::ExprKind::Cast(..) |
+      hir::ExprKind::Unary(..) |
+      hir::ExprKind::Break(..) |
+      hir::ExprKind::Continue(_) |
+      hir::ExprKind::Lit(_) |
+      hir::ExprKind::Ret(..) |
+      hir::ExprKind::Block(..) |
+      hir::ExprKind::Assign(..) |
+      hir::ExprKind::AssignOp(..) |
+      hir::ExprKind::Struct(..) |
+      hir::ExprKind::Repeat(..) |
+      hir::ExprKind::InlineAsm(..) |
+      hir::ExprKind::Box(..) |
+      hir::ExprKind::Yield(..) |
+      hir::ExprKind::Type(..) |
+      hir::ExprKind::Path(hir::QPath::TypeRelative(..)) => {
           intravisit::walk_expr(ir, expr);
       }
     }
diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs
index 13b1660a7d5..a504697008e 100644
--- a/src/librustc/middle/reachable.rs
+++ b/src/librustc/middle/reachable.rs
@@ -279,13 +279,20 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
                     // These are normal, nothing reachable about these
                     // inherently and their children are already in the
                     // worklist, as determined by the privacy pass
-                    hir::ItemKind::ExternCrate(_) | hir::ItemKind::Use(..) |
+                    hir::ItemKind::ExternCrate(_) |
+                    hir::ItemKind::Use(..) |
                     hir::ItemKind::Existential(..) |
-                    hir::ItemKind::Ty(..) | hir::ItemKind::Static(..) |
-                    hir::ItemKind::Mod(..) | hir::ItemKind::ForeignMod(..) |
-                    hir::ItemKind::Impl(..) | hir::ItemKind::Trait(..) | hir::ItemKind::TraitAlias(..) |
-                    hir::ItemKind::Struct(..) | hir::ItemKind::Enum(..) |
-                    hir::ItemKind::Union(..) |  hir::ItemKind::GlobalAsm(..) => {}
+                    hir::ItemKind::Ty(..) |
+                    hir::ItemKind::Static(..) |
+                    hir::ItemKind::Mod(..) |
+                    hir::ItemKind::ForeignMod(..) |
+                    hir::ItemKind::Impl(..) |
+                    hir::ItemKind::Trait(..) |
+                    hir::ItemKind::TraitAlias(..) |
+                    hir::ItemKind::Struct(..) |
+                    hir::ItemKind::Enum(..) |
+                    hir::ItemKind::Union(..) |
+                    hir::ItemKind::GlobalAsm(..) => {}
                 }
             }
             hir_map::NodeTraitItem(trait_method) => {
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index 7953774856f..05a6cd9c243 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -675,7 +675,9 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
                     //                          ^            ^ this gets resolved in the scope of
                     //                                         the exist_ty generics
                     let (generics, bounds) = match self.tcx.hir.expect_item(id).node {
-                        hir::ItemKind::Existential(hir::ExistTy{ ref generics, ref bounds, .. }) => (
+                        hir::ItemKind::Existential(
+                            hir::ExistTy { ref generics, ref bounds, .. }
+                        ) => (
                             generics,
                             bounds,
                         ),
diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs
index fd9378271a2..ad4a4fbff64 100644
--- a/src/librustc_lint/types.rs
+++ b/src/librustc_lint/types.rs
@@ -285,7 +285,12 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
 
         fn is_comparison(binop: hir::BinOp) -> bool {
             match binop.node {
-                hir::BinOpKind::Eq | hir::BinOpKind::Lt | hir::BinOpKind::Le | hir::BinOpKind::Ne | hir::BinOpKind::Ge | hir::BinOpKind::Gt => true,
+                hir::BinOpKind::Eq |
+                hir::BinOpKind::Lt |
+                hir::BinOpKind::Le |
+                hir::BinOpKind::Ne |
+                hir::BinOpKind::Ge |
+                hir::BinOpKind::Gt => true,
                 _ => false,
             }
         }
diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs
index 958f97d87cb..3d64fa572d1 100644
--- a/src/librustc_lint/unused.rs
+++ b/src/librustc_lint/unused.rs
@@ -102,16 +102,29 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
             // attribute which does exist on the comparison trait methods
             hir::ExprKind::Binary(bin_op, ..)  => {
                 match bin_op.node {
-                    hir::BinOpKind::Eq | hir::BinOpKind::Lt | hir::BinOpKind::Le | hir::BinOpKind::Ne | hir::BinOpKind::Ge | hir::BinOpKind::Gt => {
+                    hir::BinOpKind::Eq |
+                    hir::BinOpKind::Lt |
+                    hir::BinOpKind::Le |
+                    hir::BinOpKind::Ne |
+                    hir::BinOpKind::Ge |
+                    hir::BinOpKind::Gt => {
                         Some("comparison")
                     },
-                    hir::BinOpKind::Add | hir::BinOpKind::Sub | hir::BinOpKind::Div | hir::BinOpKind::Mul | hir::BinOpKind::Rem => {
+                    hir::BinOpKind::Add |
+                    hir::BinOpKind::Sub |
+                    hir::BinOpKind::Div |
+                    hir::BinOpKind::Mul |
+                    hir::BinOpKind::Rem => {
                         Some("arithmetic operation")
                     },
                     hir::BinOpKind::And | hir::BinOpKind::Or => {
                         Some("logical operation")
                     },
-                    hir::BinOpKind::BitXor | hir::BinOpKind::BitAnd | hir::BinOpKind::BitOr | hir::BinOpKind::Shl | hir::BinOpKind::Shr => {
+                    hir::BinOpKind::BitXor |
+                    hir::BinOpKind::BitAnd |
+                    hir::BinOpKind::BitOr |
+                    hir::BinOpKind::Shl |
+                    hir::BinOpKind::Shr => {
                         Some("bitwise operation")
                     },
                 }
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
index b8c50e88529..fc0e64d0a8a 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
@@ -263,7 +263,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
                 //
                 //     &
                 //     - let's call the lifetime of this reference `'1`
-                (ty::TyRef(region, referent_ty, _), hir::TyKind::Rptr(_lifetime, referent_hir_ty)) => {
+                (
+                    ty::TyRef(region, referent_ty, _),
+                    hir::TyKind::Rptr(_lifetime, referent_hir_ty),
+                ) => {
                     if region.to_region_vid() == needle_fr {
                         let region_name = self.synthesize_region_name(counter);
 
@@ -287,7 +290,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
                 }
 
                 // Match up something like `Foo<'1>`
-                (ty::TyAdt(_adt_def, substs), hir::TyKind::Path(hir::QPath::Resolved(None, path))) => {
+                (
+                    ty::TyAdt(_adt_def, substs),
+                    hir::TyKind::Path(hir::QPath::Resolved(None, path)),
+                ) => {
                     if let Some(last_segment) = path.segments.last() {
                         if let Some(name) = self.match_adt_and_segment(
                             substs,
diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs
index c281e1a482a..13b2a0ab874 100644
--- a/src/librustc_mir/hair/cx/expr.rs
+++ b/src/librustc_mir/hair/cx/expr.rs
@@ -238,7 +238,9 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
                     args: vec![fun.to_ref(), tupled_args.to_ref()],
                 }
             } else {
-                let adt_data = if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = fun.node {
+                let adt_data = if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) =
+                    fun.node
+                {
                     // Tuple-like ADTs are represented as ExprKind::Call. We convert them here.
                     expr_ty.ty_adt_def().and_then(|adt_def| {
                         match path.def {
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index 826577ff6ba..ab383287773 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -216,9 +216,15 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
                 }
             }
             hir::ItemKind::Existential(..) |
-            hir::ItemKind::Use(..) | hir::ItemKind::Static(..) | hir::ItemKind::Const(..) |
-            hir::ItemKind::GlobalAsm(..) | hir::ItemKind::Ty(..) | hir::ItemKind::Mod(..) | hir::ItemKind::TraitAlias(..) |
-            hir::ItemKind::Fn(..) | hir::ItemKind::ExternCrate(..) => {}
+            hir::ItemKind::Use(..) |
+            hir::ItemKind::Static(..) |
+            hir::ItemKind::Const(..) |
+            hir::ItemKind::GlobalAsm(..) |
+            hir::ItemKind::Ty(..) |
+            hir::ItemKind::Mod(..) |
+            hir::ItemKind::TraitAlias(..) |
+            hir::ItemKind::Fn(..) |
+            hir::ItemKind::ExternCrate(..) => {}
         }
 
         // Mark all items in interfaces of reachable items as reachable
@@ -373,7 +379,8 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
         loop {
             let module = if module_id == ast::CRATE_NODE_ID {
                 &self.tcx.hir.krate().module
-            } else if let hir::ItemKind::Mod(ref module) = self.tcx.hir.expect_item(module_id).node {
+            } else if let hir::ItemKind::Mod(ref module) = self.tcx.hir.expect_item(module_id).node
+            {
                 module
             } else {
                 unreachable!()
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index fca35dec067..92b35bd50f3 100644
--- a/src/librustc_typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -306,7 +306,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                 if self.can_coerce(ref_ty, expected) {
                     if let Ok(src) = cm.span_to_snippet(sp) {
                         let sugg_expr = match expr.node { // parenthesize if needed (Issue #46756)
-                            hir::ExprKind::Cast(_, _) | hir::ExprKind::Binary(_, _, _) => format!("({})", src),
+                            hir::ExprKind::Cast(_, _) |
+                            hir::ExprKind::Binary(_, _, _) => format!("({})", src),
                             _ => src,
                         };
                         if let Some(sugg) = self.can_use_as_ref(expr) {
diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs
index c2c56edfc09..026a9de5052 100644
--- a/src/librustc_typeck/check/method/suggest.rs
+++ b/src/librustc_typeck/check/method/suggest.rs
@@ -389,7 +389,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                     if let Some(expr) = rcvr_expr {
                         if let Ok(expr_string) = tcx.sess.codemap().span_to_snippet(expr.span) {
                             report_function!(expr.span, expr_string);
-                        } else if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = expr.node {
+                        } else if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) =
+                            expr.node
+                        {
                             if let Some(segment) = path.segments.last() {
                                 report_function!(expr.span, segment.ident);
                             }
diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs
index ba90f201b63..46746d4bd29 100644
--- a/src/librustc_typeck/check/op.rs
+++ b/src/librustc_typeck/check/op.rs
@@ -363,10 +363,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
                                 hir::BinOpKind::BitOr  => Some("std::ops::BitOr"),
                                 hir::BinOpKind::Shl    => Some("std::ops::Shl"),
                                 hir::BinOpKind::Shr    => Some("std::ops::Shr"),
-                                hir::BinOpKind::Eq | hir::BinOpKind::Ne => Some("std::cmp::PartialEq"),
-                                hir::BinOpKind::Lt | hir::BinOpKind::Le | hir::BinOpKind::Gt | hir::BinOpKind::Ge =>
-                                    Some("std::cmp::PartialOrd"),
-                                _             => None
+                                hir::BinOpKind::Eq |
+                                hir::BinOpKind::Ne => Some("std::cmp::PartialEq"),
+                                hir::BinOpKind::Lt |
+                                hir::BinOpKind::Le |
+                                hir::BinOpKind::Gt |
+                                hir::BinOpKind::Ge => Some("std::cmp::PartialOrd"),
+                                _ => None
                             };
                             if let Some(missing_trait) = missing_trait {
                                 if op.node == hir::BinOpKind::Add &&
diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index 61f8f571d6a..3207ac44948 100644
--- a/src/librustc_typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -117,7 +117,8 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
     // operating on scalars, we clear the overload.
     fn fix_scalar_builtin_expr(&mut self, e: &hir::Expr) {
         match e.node {
-            hir::ExprKind::Unary(hir::UnNeg, ref inner) | hir::ExprKind::Unary(hir::UnNot, ref inner) => {
+            hir::ExprKind::Unary(hir::UnNeg, ref inner) |
+            hir::ExprKind::Unary(hir::UnNot, ref inner) => {
                 let inner_ty = self.fcx.node_ty(inner.hir_id);
                 let inner_ty = self.fcx.resolve_type_vars_if_possible(&inner_ty);
 
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 7fcfea0cead..4b628d6ffad 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -420,7 +420,10 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) {
             }
         },
         hir::ItemKind::Existential(..) => {}
-        hir::ItemKind::Ty(..) | hir::ItemKind::Static(..) | hir::ItemKind::Const(..) | hir::ItemKind::Fn(..) => {
+        hir::ItemKind::Ty(..) |
+        hir::ItemKind::Static(..) |
+        hir::ItemKind::Const(..) |
+        hir::ItemKind::Fn(..) => {
             tcx.generics_of(def_id);
             tcx.type_of(def_id);
             tcx.predicates_of(def_id);
@@ -840,7 +843,8 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                     generics
                 }
 
-                ItemKind::Trait(_, _, ref generics, ..) | ItemKind::TraitAlias(ref generics, ..) => {
+                ItemKind::Trait(_, _, ref generics, ..) |
+                ItemKind::TraitAlias(ref generics, ..) => {
                     // Add in the self type parameter.
                     //
                     // Something of a hack: use the node id for the trait, also as