Skip to content

Commit 75dbbba

Browse files
committed
Run x.py fmt
1 parent 756d4bb commit 75dbbba

File tree

24 files changed

+228
-213
lines changed

24 files changed

+228
-213
lines changed

compiler/rustc_builtin_macros/src/deriving/clone.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ pub fn expand_deriving_clone(
4545
{
4646
bounds = vec![];
4747
is_shallow = true;
48-
substructure = combine_substructure(box (|c, s, sub| {
49-
cs_clone_shallow("Clone", c, s, sub, false)
50-
}));
48+
substructure = combine_substructure(
49+
box (|c, s, sub| cs_clone_shallow("Clone", c, s, sub, false)),
50+
);
5151
} else {
5252
bounds = vec![];
5353
is_shallow = false;
@@ -58,15 +58,14 @@ pub fn expand_deriving_clone(
5858
ItemKind::Union(..) => {
5959
bounds = vec![Literal(path_std!(marker::Copy))];
6060
is_shallow = true;
61-
substructure = combine_substructure(box (|c, s, sub| {
62-
cs_clone_shallow("Clone", c, s, sub, true)
63-
}));
61+
substructure = combine_substructure(
62+
box (|c, s, sub| cs_clone_shallow("Clone", c, s, sub, true)),
63+
);
6464
}
6565
_ => {
6666
bounds = vec![];
6767
is_shallow = false;
68-
substructure =
69-
combine_substructure(box (|c, s, sub| cs_clone("Clone", c, s, sub)));
68+
substructure = combine_substructure(box (|c, s, sub| cs_clone("Clone", c, s, sub)));
7069
}
7170
},
7271

compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ pub fn expand_deriving_eq(
3838
attributes: attrs,
3939
is_unsafe: false,
4040
unify_fieldless_variants: true,
41-
combine_substructure: combine_substructure(box (|a, b, c| {
42-
cs_total_eq_assert(a, b, c)
43-
})),
41+
combine_substructure: combine_substructure(box (|a, b, c| cs_total_eq_assert(a, b, c))),
4442
}],
4543
associated_types: Vec::new(),
4644
};

compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ pub fn expand_deriving_partial_ord(
3535
attributes: attrs,
3636
is_unsafe: false,
3737
unify_fieldless_variants: true,
38-
combine_substructure: combine_substructure(box (|cx, span, substr| {
39-
cs_partial_cmp(cx, span, substr)
40-
})),
38+
combine_substructure: combine_substructure(
39+
box (|cx, span, substr| cs_partial_cmp(cx, span, substr)),
40+
),
4141
};
4242

4343
let trait_def = TraitDef {

compiler/rustc_builtin_macros/src/deriving/debug.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ pub fn expand_deriving_debug(
2020
push: &mut dyn FnMut(Annotatable),
2121
) {
2222
// &mut ::std::fmt::Formatter
23-
let fmtr =
24-
Ptr(box (Literal(path_std!(fmt::Formatter))), Borrowed(None, ast::Mutability::Mut));
23+
let fmtr = Ptr(box (Literal(path_std!(fmt::Formatter))), Borrowed(None, ast::Mutability::Mut));
2524

2625
let trait_def = TraitDef {
2726
span,
@@ -40,9 +39,7 @@ pub fn expand_deriving_debug(
4039
attributes: Vec::new(),
4140
is_unsafe: false,
4241
unify_fieldless_variants: false,
43-
combine_substructure: combine_substructure(box (|a, b, c| {
44-
show_substructure(a, b, c)
45-
})),
42+
combine_substructure: combine_substructure(box (|a, b, c| show_substructure(a, b, c))),
4643
}],
4744
associated_types: Vec::new(),
4845
};

compiler/rustc_builtin_macros/src/deriving/decodable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ pub fn expand_deriving_rustc_decodable(
5858
attributes: Vec::new(),
5959
is_unsafe: false,
6060
unify_fieldless_variants: false,
61-
combine_substructure: combine_substructure(box (|a, b, c| {
62-
decodable_substructure(a, b, c, krate)
63-
})),
61+
combine_substructure: combine_substructure(
62+
box (|a, b, c| decodable_substructure(a, b, c, krate)),
63+
),
6464
}],
6565
associated_types: Vec::new(),
6666
};

compiler/rustc_builtin_macros/src/deriving/default.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ pub fn expand_deriving_default(
4141
attributes: attrs,
4242
is_unsafe: false,
4343
unify_fieldless_variants: false,
44-
combine_substructure: combine_substructure(box (|cx, trait_span, substr| {
45-
match substr.fields {
44+
combine_substructure: combine_substructure(
45+
box (|cx, trait_span, substr| match substr.fields {
4646
StaticStruct(_, fields) => {
4747
default_struct_substructure(cx, trait_span, substr, fields)
4848
}
@@ -59,8 +59,8 @@ pub fn expand_deriving_default(
5959
default_enum_substructure(cx, trait_span, enum_def)
6060
}
6161
_ => cx.span_bug(trait_span, "method in `derive(Default)`"),
62-
}
63-
})),
62+
}),
63+
),
6464
}],
6565
associated_types: Vec::new(),
6666
};

compiler/rustc_builtin_macros/src/deriving/encodable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ pub fn expand_deriving_rustc_encodable(
143143
attributes: Vec::new(),
144144
is_unsafe: false,
145145
unify_fieldless_variants: false,
146-
combine_substructure: combine_substructure(box (|a, b, c| {
147-
encodable_substructure(a, b, c, krate)
148-
})),
146+
combine_substructure: combine_substructure(
147+
box (|a, b, c| encodable_substructure(a, b, c, krate)),
148+
),
149149
}],
150150
associated_types: Vec::new(),
151151
};

compiler/rustc_builtin_macros/src/deriving/hash.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ pub fn expand_deriving_hash(
3737
attributes: vec![],
3838
is_unsafe: false,
3939
unify_fieldless_variants: true,
40-
combine_substructure: combine_substructure(box (|a, b, c| {
41-
hash_substructure(a, b, c)
42-
})),
40+
combine_substructure: combine_substructure(box (|a, b, c| hash_substructure(a, b, c))),
4341
}],
4442
associated_types: Vec::new(),
4543
};

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,10 +1934,12 @@ pub fn submit_pre_lto_module_to_llvm<B: ExtraBackendMethods>(
19341934
})
19351935
};
19361936
// Schedule the module to be loaded
1937-
drop(tx_to_llvm_workers.send(box (Message::AddImportOnlyModule::<B> {
1938-
module_data: SerializedModule::FromUncompressedFile(mmap),
1939-
work_product: module.source,
1940-
})));
1937+
drop(tx_to_llvm_workers.send(
1938+
box (Message::AddImportOnlyModule::<B> {
1939+
module_data: SerializedModule::FromUncompressedFile(mmap),
1940+
work_product: module.source,
1941+
}),
1942+
));
19411943
}
19421944

19431945
pub fn pre_lto_bitcode_filename(module_name: &str) -> String {

compiler/rustc_data_structures/src/owning_ref/tests.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,8 @@ mod owning_ref_mut {
465465

466466
#[test]
467467
fn map_chained_inference() {
468-
let or = BoxRefMut::new(box (example().1))
469-
.map_mut(|x| &mut x[..5])
470-
.map_mut(|x| &mut x[1..3]);
468+
let or =
469+
BoxRefMut::new(box (example().1)).map_mut(|x| &mut x[..5]).map_mut(|x| &mut x[1..3]);
471470
assert_eq!(&*or, "el");
472471
}
473472

@@ -509,11 +508,9 @@ mod owning_ref_mut {
509508

510509
#[test]
511510
fn erased_owner() {
512-
let o1: BoxRefMut<Example, str> =
513-
BoxRefMut::new(box (example())).map_mut(|x| &mut x.1[..]);
511+
let o1: BoxRefMut<Example, str> = BoxRefMut::new(box (example())).map_mut(|x| &mut x.1[..]);
514512

515-
let o2: BoxRefMut<String, str> =
516-
BoxRefMut::new(box (example().1)).map_mut(|x| &mut x[..]);
513+
let o2: BoxRefMut<String, str> = BoxRefMut::new(box (example().1)).map_mut(|x| &mut x[..]);
517514

518515
let os: Vec<ErasedBoxRefMut<str>> = vec![o1.erase_owner(), o2.erase_owner()];
519516
assert!(os.iter().all(|e| &e[..] == "hello world"));

compiler/rustc_driver/src/lib.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,16 +1163,18 @@ pub fn catch_with_exit_code(f: impl FnOnce() -> interface::Result<()>) -> i32 {
11631163
static DEFAULT_HOOK: SyncLazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
11641164
SyncLazy::new(|| {
11651165
let hook = panic::take_hook();
1166-
panic::set_hook(box (|info| {
1167-
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
1168-
(*DEFAULT_HOOK)(info);
1166+
panic::set_hook(
1167+
box (|info| {
1168+
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
1169+
(*DEFAULT_HOOK)(info);
11691170

1170-
// Separate the output with an empty line
1171-
eprintln!();
1171+
// Separate the output with an empty line
1172+
eprintln!();
11721173

1173-
// Print the ICE message
1174-
report_ice(info, BUG_REPORT_URL);
1175-
}));
1174+
// Print the ICE message
1175+
report_ice(info, BUG_REPORT_URL);
1176+
}),
1177+
);
11761178
hook
11771179
});
11781180

compiler/rustc_errors/src/diagnostic_builder.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,11 +409,9 @@ impl<'a> DiagnosticBuilder<'a> {
409409
/// diagnostic.
410410
crate fn new_diagnostic(handler: &'a Handler, diagnostic: Diagnostic) -> DiagnosticBuilder<'a> {
411411
debug!("Created new diagnostic");
412-
DiagnosticBuilder(box (DiagnosticBuilderInner {
413-
handler,
414-
diagnostic,
415-
allow_suggestions: true,
416-
}))
412+
DiagnosticBuilder(
413+
box (DiagnosticBuilderInner { handler, diagnostic, allow_suggestions: true }),
414+
)
417415
}
418416
}
419417

compiler/rustc_expand/src/mbe/macro_parser.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -544,18 +544,20 @@ fn inner_parse_loop<'root, 'tt>(
544544
}
545545

546546
let matches = create_matches(item.matches.len());
547-
cur_items.push(MatcherPosHandle::Box(box (MatcherPos {
548-
stack: smallvec![],
549-
sep: seq.separator.clone(),
550-
seq_op: Some(seq.kleene.op),
551-
idx: 0,
552-
matches,
553-
match_lo: item.match_cur,
554-
match_cur: item.match_cur,
555-
match_hi: item.match_cur + seq.num_captures,
556-
up: Some(item),
557-
top_elts: Tt(TokenTree::Sequence(sp, seq)),
558-
})));
547+
cur_items.push(MatcherPosHandle::Box(
548+
box (MatcherPos {
549+
stack: smallvec![],
550+
sep: seq.separator.clone(),
551+
seq_op: Some(seq.kleene.op),
552+
idx: 0,
553+
matches,
554+
match_lo: item.match_cur,
555+
match_cur: item.match_cur,
556+
match_hi: item.match_cur + seq.num_captures,
557+
up: Some(item),
558+
top_elts: Tt(TokenTree::Sequence(sp, seq)),
559+
}),
560+
));
559561
}
560562

561563
// We need to match a metavar (but the identifier is invalid)... this is an error

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -546,17 +546,19 @@ pub fn compile_declarative_macro(
546546
None => {}
547547
}
548548

549-
mk_syn_ext(box (MacroRulesMacroExpander {
550-
name: def.ident,
551-
span: def.span,
552-
transparency,
553-
lhses,
554-
rhses,
555-
valid,
556-
// Macros defined in the current crate have a real node id,
557-
// whereas macros from an external crate have a dummy id.
558-
is_local: def.id != DUMMY_NODE_ID,
559-
}))
549+
mk_syn_ext(
550+
box (MacroRulesMacroExpander {
551+
name: def.ident,
552+
span: def.span,
553+
transparency,
554+
lhses,
555+
rhses,
556+
valid,
557+
// Macros defined in the current crate have a real node id,
558+
// whereas macros from an external crate have a dummy id.
559+
is_local: def.id != DUMMY_NODE_ID,
560+
}),
561+
)
560562
}
561563

562564
fn check_lhs_nt_follows(

compiler/rustc_infer/src/infer/error_reporting/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
812812
);
813813
let sugg = arm_spans
814814
.flat_map(|sp| {
815-
vec![
816-
(sp.shrink_to_lo(), "box (".to_string()),
817-
(sp.shrink_to_hi(), ")".to_string()),
818-
]
819-
.into_iter()
815+
vec![(sp.shrink_to_lo(), "box (".to_string()), (sp.shrink_to_hi(), ")".to_string())]
816+
.into_iter()
820817
})
821818
.collect::<Vec<_>>();
822819
err.multipart_suggestion(

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,19 +1304,21 @@ impl<F> DerefMut for FmtPrinter<'_, '_, F> {
13041304

13051305
impl<F> FmtPrinter<'a, 'tcx, F> {
13061306
pub fn new(tcx: TyCtxt<'tcx>, fmt: F, ns: Namespace) -> Self {
1307-
FmtPrinter(box (FmtPrinterData {
1308-
tcx,
1309-
fmt,
1310-
empty_path: false,
1311-
in_value: ns == Namespace::ValueNS,
1312-
print_alloc_ids: false,
1313-
used_region_names: Default::default(),
1314-
region_index: 0,
1315-
binder_depth: 0,
1316-
printed_type_count: 0,
1317-
region_highlight_mode: RegionHighlightMode::default(),
1318-
name_resolver: None,
1319-
}))
1307+
FmtPrinter(
1308+
box (FmtPrinterData {
1309+
tcx,
1310+
fmt,
1311+
empty_path: false,
1312+
in_value: ns == Namespace::ValueNS,
1313+
print_alloc_ids: false,
1314+
used_region_names: Default::default(),
1315+
region_index: 0,
1316+
binder_depth: 0,
1317+
printed_type_count: 0,
1318+
region_highlight_mode: RegionHighlightMode::default(),
1319+
name_resolver: None,
1320+
}),
1321+
)
13201322
}
13211323
}
13221324

compiler/rustc_mir/src/transform/const_prop.rs

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -798,11 +798,13 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
798798

799799
/// Creates a new `Operand::Constant` from a `Scalar` value
800800
fn operand_from_scalar(&self, scalar: Scalar, ty: Ty<'tcx>, span: Span) -> Operand<'tcx> {
801-
Operand::Constant(box (Constant {
802-
span,
803-
user_ty: None,
804-
literal: ty::Const::from_scalar(self.tcx, scalar, ty).into(),
805-
}))
801+
Operand::Constant(
802+
box (Constant {
803+
span,
804+
user_ty: None,
805+
literal: ty::Const::from_scalar(self.tcx, scalar, ty).into(),
806+
}),
807+
)
806808
}
807809

808810
fn replace_with_const(
@@ -881,21 +883,23 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
881883
if let Some(Some(alloc)) = alloc {
882884
// Assign entire constant in a single statement.
883885
// We can't use aggregates, as we run after the aggregate-lowering `MirPhase`.
884-
*rval = Rvalue::Use(Operand::Constant(box (Constant {
885-
span: source_info.span,
886-
user_ty: None,
887-
literal: self
888-
.ecx
889-
.tcx
890-
.mk_const(ty::Const {
891-
ty,
892-
val: ty::ConstKind::Value(ConstValue::ByRef {
893-
alloc,
894-
offset: Size::ZERO,
895-
}),
896-
})
897-
.into(),
898-
})));
886+
*rval = Rvalue::Use(Operand::Constant(
887+
box (Constant {
888+
span: source_info.span,
889+
user_ty: None,
890+
literal: self
891+
.ecx
892+
.tcx
893+
.mk_const(ty::Const {
894+
ty,
895+
val: ty::ConstKind::Value(ConstValue::ByRef {
896+
alloc,
897+
offset: Size::ZERO,
898+
}),
899+
})
900+
.into(),
901+
}),
902+
));
899903
}
900904
}
901905
}

0 commit comments

Comments
 (0)