about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustc/hir/intravisit.rs5
-rw-r--r--src/librustc/hir/lowering.rs4
-rw-r--r--src/librustc/hir/lowering/item.rs51
-rw-r--r--src/librustc_lint/builtin.rs6
-rw-r--r--src/librustc_lint/nonstandard_style.rs8
-rw-r--r--src/librustc_typeck/check/mod.rs7
-rw-r--r--src/librustc_typeck/check/writeback.rs4
7 files changed, 60 insertions, 25 deletions
diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs
index bd975c6c95d..26e287037f7 100644
--- a/src/librustc/hir/intravisit.rs
+++ b/src/librustc/hir/intravisit.rs
@@ -948,7 +948,10 @@ pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'
     visitor.visit_defaultness(defaultness);
 }
 
-pub fn walk_struct_def<'v, V: Visitor<'v>>(visitor: &mut V, struct_definition: &'v VariantData<'v>) {
+pub fn walk_struct_def<'v, V: Visitor<'v>>(
+    visitor: &mut V,
+    struct_definition: &'v VariantData<'v>,
+) {
     if let Some(ctor_hir_id) = struct_definition.ctor_hir_id() {
         visitor.visit_id(ctor_hir_id);
     }
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index cac4c694316..83869951ea2 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -1579,7 +1579,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
             output_lifetime_params: Vec<hir::GenericParam>,
         }
 
-        impl<'r, 'a, 'v, 'hir> hir::intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a, 'hir> {
+        impl<'r, 'a, 'v, 'hir> hir::intravisit::Visitor<'v>
+        for ImplTraitLifetimeCollector<'r, 'a, 'hir>
+        {
             fn nested_visit_map<'this>(
                 &'this mut self,
             ) -> hir::intravisit::NestedVisitorMap<'this, 'v> {
diff --git a/src/librustc/hir/lowering/item.rs b/src/librustc/hir/lowering/item.rs
index d5440663c49..4492845acb8 100644
--- a/src/librustc/hir/lowering/item.rs
+++ b/src/librustc/hir/lowering/item.rs
@@ -164,7 +164,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
     pub(super) fn lower_mod(&mut self, m: &Mod) -> hir::Mod<'hir> {
         hir::Mod {
             inner: m.inner,
-            item_ids: self.arena.alloc_from_iter(m.items.iter().flat_map(|x| self.lower_item_id(x))),
+            item_ids: self.arena.alloc_from_iter(
+                m.items.iter().flat_map(|x| self.lower_item_id(x))
+            ),
         }
     }
 
@@ -560,7 +562,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
                     });
                 }
 
-                let path = self.arena.alloc(self.lower_path_extra(ret_res, &path, ParamMode::Explicit, None));
+                let path = self.lower_path_extra(ret_res, &path, ParamMode::Explicit, None);
+                let path = self.arena.alloc(path);
                 hir::ItemKind::Use(path, hir::UseKind::Single)
             }
             UseTreeKind::Glob => {
@@ -667,7 +670,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
 
                 let res = self.expect_full_res_from_use(id).next().unwrap_or(Res::Err);
                 let res = self.lower_res(res);
-                let path = self.arena.alloc(self.lower_path_extra(res, &prefix, ParamMode::Explicit, None));
+                let path = self.lower_path_extra(res, &prefix, ParamMode::Explicit, None);
+                let path = self.arena.alloc(path);
                 hir::ItemKind::Use(path, hir::UseKind::ListStem)
             }
         }
@@ -733,8 +737,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
                     hir::ForeignItemKind::Fn(fn_dec, fn_args, generics)
                 }
                 ForeignItemKind::Static(ref t, m) => {
-                    hir::ForeignItemKind::Static(
-                        self.arena.alloc(self.lower_ty(t, ImplTraitContext::disallowed()).into_inner()), m)
+                    let ty = self.lower_ty(t, ImplTraitContext::disallowed());
+                    hir::ForeignItemKind::Static(self.arena.alloc(ty.into_inner()), m)
                 }
                 ForeignItemKind::Ty => hir::ForeignItemKind::Type,
                 ForeignItemKind::Macro(_) => panic!("macro shouldn't exist here"),
@@ -771,7 +775,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
     fn lower_variant_data(&mut self, vdata: &VariantData) -> hir::VariantData<'hir> {
         match *vdata {
             VariantData::Struct(ref fields, recovered) => hir::VariantData::Struct(
-                self.arena.alloc_from_iter(fields.iter().enumerate().map(|f| self.lower_struct_field(f))),
+                self.arena.alloc_from_iter(
+                    fields.iter().enumerate().map(|f| self.lower_struct_field(f))
+                ),
                 recovered,
             ),
             VariantData::Tuple(ref fields, id) => {
@@ -823,15 +829,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
         let trait_item_def_id = self.resolver.definitions().local_def_id(i.id);
 
         let (generics, kind) = match i.kind {
-            AssocItemKind::Const(ref ty, ref default) => (
-                self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
-                hir::TraitItemKind::Const(
-                    self.arena.alloc(self.lower_ty(ty, ImplTraitContext::disallowed()).into_inner()),
+            AssocItemKind::Const(ref ty, ref default) => {
+                let generics = self.lower_generics(&i.generics, ImplTraitContext::disallowed());
+                let ty = self.lower_ty(ty, ImplTraitContext::disallowed());
+                let ty = self.arena.alloc(ty.into_inner());
+                (generics, hir::TraitItemKind::Const(
+                    ty,
                     default
                         .as_ref()
                         .map(|x| self.lower_const_body(i.span, Some(x))),
-                ),
-            ),
+                ))
+            },
             AssocItemKind::Fn(ref sig, None) => {
                 let names = self.lower_fn_params_to_names(&sig.decl);
                 let (generics, sig) = self.lower_method_sig(
@@ -913,13 +921,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
         let impl_item_def_id = self.resolver.definitions().local_def_id(i.id);
 
         let (generics, kind) = match i.kind {
-            AssocItemKind::Const(ref ty, ref expr) => (
-                self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
-                hir::ImplItemKind::Const(
-                    self.arena.alloc(self.lower_ty(ty, ImplTraitContext::disallowed()).into_inner()),
+            AssocItemKind::Const(ref ty, ref expr) => {
+                let generics = self.lower_generics(&i.generics, ImplTraitContext::disallowed());
+                let ty = self.lower_ty(ty, ImplTraitContext::disallowed());
+                let ty = self.arena.alloc(ty.into_inner());
+                (generics, hir::ImplItemKind::Const(
+                    ty,
                     self.lower_const_body(i.span, expr.as_deref()),
-                ),
-            ),
+                ))
+            },
             AssocItemKind::Fn(ref sig, ref body) => {
                 self.current_item = Some(i.span);
                 let body_id = self.lower_maybe_async_body(
@@ -1302,7 +1312,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
                     this.expr_block(P(body), AttrVec::new())
                 });
 
-            (this.arena.alloc_from_iter(parameters), this.expr(body_span, async_expr, AttrVec::new()))
+            (
+                this.arena.alloc_from_iter(parameters),
+                this.expr(body_span, async_expr, AttrVec::new()),
+            )
         })
     }
 
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index b83bfedc824..23133454bd9 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -996,7 +996,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnreachablePub {
         self.perform_lint(cx, "item", item.hir_id, &item.vis, item.span, true);
     }
 
-    fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, foreign_item: &hir::ForeignItem<'tcx>) {
+    fn check_foreign_item(
+        &mut self,
+        cx: &LateContext<'_, '_>,
+        foreign_item: &hir::ForeignItem<'tcx>,
+    ) {
         self.perform_lint(cx, "item", foreign_item.hir_id, &foreign_item.vis,
                           foreign_item.span, true);
     }
diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs
index 08d7a90c7b0..bd2cbee2c34 100644
--- a/src/librustc_lint/nonstandard_style.rs
+++ b/src/librustc_lint/nonstandard_style.rs
@@ -246,7 +246,13 @@ impl NonSnakeCase {
 }
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
-    fn check_mod(&mut self, cx: &LateContext<'_, '_>, _: &'tcx hir::Mod<'tcx>, _: Span, id: hir::HirId) {
+    fn check_mod(
+        &mut self,
+        cx: &LateContext<'_, '_>,
+        _: &'tcx hir::Mod<'tcx>,
+        _: Span,
+        id: hir::HirId,
+    ) {
         if id != hir::CRATE_HIR_ID {
             return;
         }
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 1cd1d4fcd3f..b2c5ddd5bd4 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -2435,7 +2435,12 @@ fn check_transparent(tcx: TyCtxt<'_>, sp: Span, def_id: DefId) {
 }
 
 #[allow(trivial_numeric_casts)]
-pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, vs: &'tcx [hir::Variant<'tcx>], id: hir::HirId) {
+pub fn check_enum<'tcx>(
+    tcx: TyCtxt<'tcx>,
+    sp: Span,
+    vs: &'tcx [hir::Variant<'tcx>],
+    id: hir::HirId,
+) {
     let def_id = tcx.hir().local_def_id(id);
     let def = tcx.adt_def(def_id);
     def.destructor(tcx); // force the destructor to be evaluated
diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index 27ce7d7c3e0..a32c98068da 100644
--- a/src/librustc_typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -32,7 +32,9 @@ use std::mem;
 // resolve_type_vars_in_body, which creates a new TypeTables which
 // doesn't contain any inference types.
 impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
-    pub fn resolve_type_vars_in_body(&self, body: &'tcx hir::Body<'tcx>) -> &'tcx ty::TypeckTables<'tcx> {
+    pub fn resolve_type_vars_in_body(&self, body: &'tcx hir::Body<'tcx>)
+        -> &'tcx ty::TypeckTables<'tcx>
+    {
         let item_id = self.tcx.hir().body_owner(body.id());
         let item_def_id = self.tcx.hir().local_def_id(item_id);