Skip to content

Commit 5f5b6e7

Browse files
committed
Tidy.
1 parent 9694ab9 commit 5f5b6e7

File tree

7 files changed

+60
-25
lines changed

7 files changed

+60
-25
lines changed

src/librustc/hir/intravisit.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,10 @@ pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'
948948
visitor.visit_defaultness(defaultness);
949949
}
950950

951-
pub fn walk_struct_def<'v, V: Visitor<'v>>(visitor: &mut V, struct_definition: &'v VariantData<'v>) {
951+
pub fn walk_struct_def<'v, V: Visitor<'v>>(
952+
visitor: &mut V,
953+
struct_definition: &'v VariantData<'v>,
954+
) {
952955
if let Some(ctor_hir_id) = struct_definition.ctor_hir_id() {
953956
visitor.visit_id(ctor_hir_id);
954957
}

src/librustc/hir/lowering.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
15791579
output_lifetime_params: Vec<hir::GenericParam>,
15801580
}
15811581

1582-
impl<'r, 'a, 'v, 'hir> hir::intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a, 'hir> {
1582+
impl<'r, 'a, 'v, 'hir> hir::intravisit::Visitor<'v>
1583+
for ImplTraitLifetimeCollector<'r, 'a, 'hir>
1584+
{
15831585
fn nested_visit_map<'this>(
15841586
&'this mut self,
15851587
) -> hir::intravisit::NestedVisitorMap<'this, 'v> {

src/librustc/hir/lowering/item.rs

+32-19
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
164164
pub(super) fn lower_mod(&mut self, m: &Mod) -> hir::Mod<'hir> {
165165
hir::Mod {
166166
inner: m.inner,
167-
item_ids: self.arena.alloc_from_iter(m.items.iter().flat_map(|x| self.lower_item_id(x))),
167+
item_ids: self.arena.alloc_from_iter(
168+
m.items.iter().flat_map(|x| self.lower_item_id(x))
169+
),
168170
}
169171
}
170172

@@ -560,7 +562,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
560562
});
561563
}
562564

563-
let path = self.arena.alloc(self.lower_path_extra(ret_res, &path, ParamMode::Explicit, None));
565+
let path = self.lower_path_extra(ret_res, &path, ParamMode::Explicit, None);
566+
let path = self.arena.alloc(path);
564567
hir::ItemKind::Use(path, hir::UseKind::Single)
565568
}
566569
UseTreeKind::Glob => {
@@ -667,7 +670,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
667670

668671
let res = self.expect_full_res_from_use(id).next().unwrap_or(Res::Err);
669672
let res = self.lower_res(res);
670-
let path = self.arena.alloc(self.lower_path_extra(res, &prefix, ParamMode::Explicit, None));
673+
let path = self.lower_path_extra(res, &prefix, ParamMode::Explicit, None);
674+
let path = self.arena.alloc(path);
671675
hir::ItemKind::Use(path, hir::UseKind::ListStem)
672676
}
673677
}
@@ -733,8 +737,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
733737
hir::ForeignItemKind::Fn(fn_dec, fn_args, generics)
734738
}
735739
ForeignItemKind::Static(ref t, m) => {
736-
hir::ForeignItemKind::Static(
737-
self.arena.alloc(self.lower_ty(t, ImplTraitContext::disallowed()).into_inner()), m)
740+
let ty = self.lower_ty(t, ImplTraitContext::disallowed());
741+
hir::ForeignItemKind::Static(self.arena.alloc(ty.into_inner()), m)
738742
}
739743
ForeignItemKind::Ty => hir::ForeignItemKind::Type,
740744
ForeignItemKind::Macro(_) => panic!("macro shouldn't exist here"),
@@ -771,7 +775,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
771775
fn lower_variant_data(&mut self, vdata: &VariantData) -> hir::VariantData<'hir> {
772776
match *vdata {
773777
VariantData::Struct(ref fields, recovered) => hir::VariantData::Struct(
774-
self.arena.alloc_from_iter(fields.iter().enumerate().map(|f| self.lower_struct_field(f))),
778+
self.arena.alloc_from_iter(
779+
fields.iter().enumerate().map(|f| self.lower_struct_field(f))
780+
),
775781
recovered,
776782
),
777783
VariantData::Tuple(ref fields, id) => {
@@ -823,15 +829,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
823829
let trait_item_def_id = self.resolver.definitions().local_def_id(i.id);
824830

825831
let (generics, kind) = match i.kind {
826-
AssocItemKind::Const(ref ty, ref default) => (
827-
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
828-
hir::TraitItemKind::Const(
829-
self.arena.alloc(self.lower_ty(ty, ImplTraitContext::disallowed()).into_inner()),
832+
AssocItemKind::Const(ref ty, ref default) => {
833+
let generics = self.lower_generics(&i.generics, ImplTraitContext::disallowed());
834+
let ty = self.lower_ty(ty, ImplTraitContext::disallowed());
835+
let ty = self.arena.alloc(ty.into_inner());
836+
(generics, hir::TraitItemKind::Const(
837+
ty,
830838
default
831839
.as_ref()
832840
.map(|x| self.lower_const_body(i.span, Some(x))),
833-
),
834-
),
841+
))
842+
},
835843
AssocItemKind::Fn(ref sig, None) => {
836844
let names = self.lower_fn_params_to_names(&sig.decl);
837845
let (generics, sig) = self.lower_method_sig(
@@ -913,13 +921,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
913921
let impl_item_def_id = self.resolver.definitions().local_def_id(i.id);
914922

915923
let (generics, kind) = match i.kind {
916-
AssocItemKind::Const(ref ty, ref expr) => (
917-
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
918-
hir::ImplItemKind::Const(
919-
self.arena.alloc(self.lower_ty(ty, ImplTraitContext::disallowed()).into_inner()),
924+
AssocItemKind::Const(ref ty, ref expr) => {
925+
let generics = self.lower_generics(&i.generics, ImplTraitContext::disallowed());
926+
let ty = self.lower_ty(ty, ImplTraitContext::disallowed());
927+
let ty = self.arena.alloc(ty.into_inner());
928+
(generics, hir::ImplItemKind::Const(
929+
ty,
920930
self.lower_const_body(i.span, expr.as_deref()),
921-
),
922-
),
931+
))
932+
},
923933
AssocItemKind::Fn(ref sig, ref body) => {
924934
self.current_item = Some(i.span);
925935
let body_id = self.lower_maybe_async_body(
@@ -1302,7 +1312,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
13021312
this.expr_block(P(body), AttrVec::new())
13031313
});
13041314

1305-
(this.arena.alloc_from_iter(parameters), this.expr(body_span, async_expr, AttrVec::new()))
1315+
(
1316+
this.arena.alloc_from_iter(parameters),
1317+
this.expr(body_span, async_expr, AttrVec::new()),
1318+
)
13061319
})
13071320
}
13081321

src/librustc_lint/builtin.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnreachablePub {
996996
self.perform_lint(cx, "item", item.hir_id, &item.vis, item.span, true);
997997
}
998998

999-
fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, foreign_item: &hir::ForeignItem<'tcx>) {
999+
fn check_foreign_item(
1000+
&mut self,
1001+
cx: &LateContext<'_, '_>,
1002+
foreign_item: &hir::ForeignItem<'tcx>,
1003+
) {
10001004
self.perform_lint(cx, "item", foreign_item.hir_id, &foreign_item.vis,
10011005
foreign_item.span, true);
10021006
}

src/librustc_lint/nonstandard_style.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,13 @@ impl NonSnakeCase {
246246
}
247247

248248
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
249-
fn check_mod(&mut self, cx: &LateContext<'_, '_>, _: &'tcx hir::Mod<'tcx>, _: Span, id: hir::HirId) {
249+
fn check_mod(
250+
&mut self,
251+
cx: &LateContext<'_, '_>,
252+
_: &'tcx hir::Mod<'tcx>,
253+
_: Span,
254+
id: hir::HirId,
255+
) {
250256
if id != hir::CRATE_HIR_ID {
251257
return;
252258
}

src/librustc_typeck/check/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2435,7 +2435,12 @@ fn check_transparent(tcx: TyCtxt<'_>, sp: Span, def_id: DefId) {
24352435
}
24362436

24372437
#[allow(trivial_numeric_casts)]
2438-
pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, vs: &'tcx [hir::Variant<'tcx>], id: hir::HirId) {
2438+
pub fn check_enum<'tcx>(
2439+
tcx: TyCtxt<'tcx>,
2440+
sp: Span,
2441+
vs: &'tcx [hir::Variant<'tcx>],
2442+
id: hir::HirId,
2443+
) {
24392444
let def_id = tcx.hir().local_def_id(id);
24402445
let def = tcx.adt_def(def_id);
24412446
def.destructor(tcx); // force the destructor to be evaluated

src/librustc_typeck/check/writeback.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ use std::mem;
3232
// resolve_type_vars_in_body, which creates a new TypeTables which
3333
// doesn't contain any inference types.
3434
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
35-
pub fn resolve_type_vars_in_body(&self, body: &'tcx hir::Body<'tcx>) -> &'tcx ty::TypeckTables<'tcx> {
35+
pub fn resolve_type_vars_in_body(&self, body: &'tcx hir::Body<'tcx>)
36+
-> &'tcx ty::TypeckTables<'tcx>
37+
{
3638
let item_id = self.tcx.hir().body_owner(body.id());
3739
let item_def_id = self.tcx.hir().local_def_id(item_id);
3840

0 commit comments

Comments
 (0)