Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 971c549

Browse files
re-format with new rustfmt
1 parent b221c87 commit 971c549

File tree

15 files changed

+111
-81
lines changed

15 files changed

+111
-81
lines changed

compiler/rustc_attr/src/builtin.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,10 @@ pub fn eval_condition(
519519
[NestedMetaItem::Literal(Lit { kind: LitKind::Str(sym, ..), span, .. })] => {
520520
(sym, span)
521521
}
522-
[NestedMetaItem::Literal(Lit { span, .. })
523-
| NestedMetaItem::MetaItem(MetaItem { span, .. })] => {
522+
[
523+
NestedMetaItem::Literal(Lit { span, .. })
524+
| NestedMetaItem::MetaItem(MetaItem { span, .. }),
525+
] => {
524526
sess.span_diagnostic
525527
.struct_span_err(*span, "expected a version literal")
526528
.emit();

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -977,9 +977,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
977977
Some(ref name),
978978
BorrowExplanation::MustBeValidFor {
979979
category:
980-
category
981-
@
982-
(ConstraintCategory::Return(_)
980+
category @ (ConstraintCategory::Return(_)
983981
| ConstraintCategory::CallArgument
984982
| ConstraintCategory::OpaqueType),
985983
from_closure: false,

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,13 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
165165
PlaceRef {
166166
local: _,
167167
projection:
168-
[.., ProjectionElem::Index(_)
169-
| ProjectionElem::ConstantIndex { .. }
170-
| ProjectionElem::Subslice { .. }
171-
| ProjectionElem::Downcast(..)],
168+
[
169+
..,
170+
ProjectionElem::Index(_)
171+
| ProjectionElem::ConstantIndex { .. }
172+
| ProjectionElem::Subslice { .. }
173+
| ProjectionElem::Downcast(..),
174+
],
172175
} => bug!("Unexpected immutable place."),
173176
}
174177

@@ -217,7 +220,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
217220
PlaceRef {
218221
local,
219222
projection:
220-
[proj_base @ .., ProjectionElem::Deref, ProjectionElem::Field(field, _), ProjectionElem::Deref],
223+
[
224+
proj_base @ ..,
225+
ProjectionElem::Deref,
226+
ProjectionElem::Field(field, _),
227+
ProjectionElem::Deref,
228+
],
221229
} => {
222230
err.span_label(span, format!("cannot {ACT}", ACT = act));
223231

@@ -763,11 +771,14 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
763771
kind:
764772
Call(
765773
_,
766-
[Expr {
767-
kind: MethodCall(path_segment, ..),
768-
hir_id,
769-
..
770-
}, ..],
774+
[
775+
Expr {
776+
kind: MethodCall(path_segment, ..),
777+
hir_id,
778+
..
779+
},
780+
..,
781+
],
771782
),
772783
..
773784
},

compiler/rustc_borrowck/src/diagnostics/region_name.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -769,20 +769,24 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
769769
let opaque_ty = hir.item(id);
770770
if let hir::ItemKind::OpaqueTy(hir::OpaqueTy {
771771
bounds:
772-
[hir::GenericBound::LangItemTrait(
773-
hir::LangItem::Future,
774-
_,
775-
_,
776-
hir::GenericArgs {
777-
bindings:
778-
[hir::TypeBinding {
779-
ident: Ident { name: sym::Output, .. },
780-
kind: hir::TypeBindingKind::Equality { ty },
781-
..
782-
}],
783-
..
784-
},
785-
)],
772+
[
773+
hir::GenericBound::LangItemTrait(
774+
hir::LangItem::Future,
775+
_,
776+
_,
777+
hir::GenericArgs {
778+
bindings:
779+
[
780+
hir::TypeBinding {
781+
ident: Ident { name: sym::Output, .. },
782+
kind: hir::TypeBindingKind::Equality { ty },
783+
..
784+
},
785+
],
786+
..
787+
},
788+
),
789+
],
786790
..
787791
}) = opaque_ty.kind
788792
{

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,14 +1525,12 @@ fn generator_layout_and_saved_local_names(
15251525
// Deref of the `Pin<&mut Self>` state argument.
15261526
mir::ProjectionElem::Field(..),
15271527
mir::ProjectionElem::Deref,
1528-
15291528
// Field of a variant of the state.
15301529
mir::ProjectionElem::Downcast(_, variant),
15311530
mir::ProjectionElem::Field(field, _),
15321531
] => {
1533-
let name = &mut generator_saved_local_names[
1534-
generator_layout.variant_fields[variant][field]
1535-
];
1532+
let name = &mut generator_saved_local_names
1533+
[generator_layout.variant_fields[variant][field]];
15361534
if name.is_none() {
15371535
name.replace(var.name);
15381536
}

compiler/rustc_expand/src/mbe/macro_parser.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,7 @@ fn inner_parse_loop<'root, 'tt>(
584584
//
585585
// At the beginning of the loop, if we reach the end of the delimited submatcher,
586586
// we pop the stack to backtrack out of the descent.
587-
seq
588-
@
589-
(TokenTree::Delimited(..)
587+
seq @ (TokenTree::Delimited(..)
590588
| TokenTree::Token(Token { kind: DocComment(..), .. })) => {
591589
let lower_elts = mem::replace(&mut item.top_elts, Tt(seq));
592590
let idx = item.idx;

compiler/rustc_expand/src/parse/tests.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,33 @@ fn string_to_tts_macro() {
6565
let tts: &[TokenTree] = &tts[..];
6666

6767
match tts {
68-
[TokenTree::Token(Token { kind: token::Ident(name_macro_rules, false), .. }), TokenTree::Token(Token { kind: token::Not, .. }), TokenTree::Token(Token { kind: token::Ident(name_zip, false), .. }), TokenTree::Delimited(_, macro_delim, macro_tts)]
69-
if name_macro_rules == &kw::MacroRules && name_zip.as_str() == "zip" =>
70-
{
68+
[
69+
TokenTree::Token(Token { kind: token::Ident(name_macro_rules, false), .. }),
70+
TokenTree::Token(Token { kind: token::Not, .. }),
71+
TokenTree::Token(Token { kind: token::Ident(name_zip, false), .. }),
72+
TokenTree::Delimited(_, macro_delim, macro_tts),
73+
] if name_macro_rules == &kw::MacroRules && name_zip.as_str() == "zip" => {
7174
let tts = &macro_tts.trees().collect::<Vec<_>>();
7275
match &tts[..] {
73-
[TokenTree::Delimited(_, first_delim, first_tts), TokenTree::Token(Token { kind: token::FatArrow, .. }), TokenTree::Delimited(_, second_delim, second_tts)]
74-
if macro_delim == &token::Paren =>
75-
{
76+
[
77+
TokenTree::Delimited(_, first_delim, first_tts),
78+
TokenTree::Token(Token { kind: token::FatArrow, .. }),
79+
TokenTree::Delimited(_, second_delim, second_tts),
80+
] if macro_delim == &token::Paren => {
7681
let tts = &first_tts.trees().collect::<Vec<_>>();
7782
match &tts[..] {
78-
[TokenTree::Token(Token { kind: token::Dollar, .. }), TokenTree::Token(Token { kind: token::Ident(name, false), .. })]
79-
if first_delim == &token::Paren && name.as_str() == "a" => {}
83+
[
84+
TokenTree::Token(Token { kind: token::Dollar, .. }),
85+
TokenTree::Token(Token { kind: token::Ident(name, false), .. }),
86+
] if first_delim == &token::Paren && name.as_str() == "a" => {}
8087
_ => panic!("value 3: {:?} {:?}", first_delim, first_tts),
8188
}
8289
let tts = &second_tts.trees().collect::<Vec<_>>();
8390
match &tts[..] {
84-
[TokenTree::Token(Token { kind: token::Dollar, .. }), TokenTree::Token(Token { kind: token::Ident(name, false), .. })]
85-
if second_delim == &token::Paren && name.as_str() == "a" => {}
91+
[
92+
TokenTree::Token(Token { kind: token::Dollar, .. }),
93+
TokenTree::Token(Token { kind: token::Ident(name, false), .. }),
94+
] if second_delim == &token::Paren && name.as_str() == "a" => {}
8695
_ => panic!("value 4: {:?} {:?}", second_delim, second_tts),
8796
}
8897
}

compiler/rustc_middle/src/ty/context.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,11 @@ impl<'tcx> TyCtxt<'tcx> {
11111111
};
11121112
debug!("layout_scalar_valid_range: attr={:?}", attr);
11131113
if let Some(
1114-
&[ast::NestedMetaItem::Literal(ast::Lit { kind: ast::LitKind::Int(a, _), .. })],
1114+
&[
1115+
ast::NestedMetaItem::Literal(ast::Lit {
1116+
kind: ast::LitKind::Int(a, _), ..
1117+
}),
1118+
],
11151119
) = attr.meta_item_list().as_deref()
11161120
{
11171121
Bound::Included(a)

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,17 @@ impl<'tcx> ClosureSubsts<'tcx> {
356356
/// The ordering assumed here must match that used by `ClosureSubsts::new` above.
357357
fn split(self) -> ClosureSubstsParts<'tcx, GenericArg<'tcx>> {
358358
match self.substs[..] {
359-
[ref parent_substs @ .., closure_kind_ty, closure_sig_as_fn_ptr_ty, tupled_upvars_ty] => {
360-
ClosureSubstsParts {
361-
parent_substs,
362-
closure_kind_ty,
363-
closure_sig_as_fn_ptr_ty,
364-
tupled_upvars_ty,
365-
}
366-
}
359+
[
360+
ref parent_substs @ ..,
361+
closure_kind_ty,
362+
closure_sig_as_fn_ptr_ty,
363+
tupled_upvars_ty,
364+
] => ClosureSubstsParts {
365+
parent_substs,
366+
closure_kind_ty,
367+
closure_sig_as_fn_ptr_ty,
368+
tupled_upvars_ty,
369+
},
367370
_ => bug!("closure substs missing synthetics"),
368371
}
369372
}

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,9 +2026,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
20262026
debug!("maybe_suggest_unsized_generics: param={:?}", param);
20272027
match node {
20282028
hir::Node::Item(
2029-
item
2030-
@
2031-
hir::Item {
2029+
item @ hir::Item {
20322030
// Only suggest indirection for uses of type parameters in ADTs.
20332031
kind:
20342032
hir::ItemKind::Enum(..) | hir::ItemKind::Struct(..) | hir::ItemKind::Union(..),

0 commit comments

Comments
 (0)