Skip to content

Commit d5b760b

Browse files
Bump rustfmt version
Also switches on formatting of the mir build module
1 parent f6cb45a commit d5b760b

File tree

30 files changed

+224
-164
lines changed

30 files changed

+224
-164
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
506506
let count = generics
507507
.params
508508
.iter()
509-
.filter(|param| matches!(param.kind, ast::GenericParamKind::Lifetime { .. }))
509+
.filter(|param| {
510+
matches!(param.kind, ast::GenericParamKind::Lifetime { .. })
511+
})
510512
.count();
511513
self.lctx.type_def_lifetime_params.insert(def_id.to_def_id(), count);
512514
}

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ impl<'a> TraitDef<'a> {
598598

599599
let mut ty_params = params
600600
.iter()
601-
.filter(|param| matches!(param.kind, ast::GenericParamKind::Type{..}))
601+
.filter(|param| matches!(param.kind, ast::GenericParamKind::Type { .. }))
602602
.peekable();
603603

604604
if ty_params.peek().is_some() {

compiler/rustc_errors/src/diagnostic_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ macro_rules! forward_inner_docs {
3636
($e:expr => $i:item) => {
3737
#[doc = $e]
3838
$i
39-
}
39+
};
4040
}
4141

4242
/// In general, the `DiagnosticBuilder` uses deref to allow access to

compiler/rustc_errors/src/snippet.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,13 @@ impl Annotation {
122122
}
123123

124124
pub fn is_multiline(&self) -> bool {
125-
matches!(self.annotation_type,
125+
matches!(
126+
self.annotation_type,
126127
AnnotationType::Multiline(_)
127-
| AnnotationType::MultilineStart(_)
128-
| AnnotationType::MultilineLine(_)
129-
| AnnotationType::MultilineEnd(_))
128+
| AnnotationType::MultilineStart(_)
129+
| AnnotationType::MultilineLine(_)
130+
| AnnotationType::MultilineEnd(_)
131+
)
130132
}
131133

132134
pub fn len(&self) -> usize {
@@ -158,7 +160,10 @@ impl Annotation {
158160

159161
pub fn takes_space(&self) -> bool {
160162
// Multiline annotations always have to keep vertical space.
161-
matches!(self.annotation_type, AnnotationType::MultilineStart(_) | AnnotationType::MultilineEnd(_))
163+
matches!(
164+
self.annotation_type,
165+
AnnotationType::MultilineStart(_) | AnnotationType::MultilineEnd(_)
166+
)
162167
}
163168
}
164169

compiler/rustc_hir/src/hir.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,10 +1543,10 @@ pub fn is_range_literal(expr: &Expr<'_>) -> bool {
15431543
**qpath,
15441544
QPath::LangItem(
15451545
LangItem::Range
1546-
| LangItem::RangeTo
1547-
| LangItem::RangeFrom
1548-
| LangItem::RangeFull
1549-
| LangItem::RangeToInclusive,
1546+
| LangItem::RangeTo
1547+
| LangItem::RangeFrom
1548+
| LangItem::RangeFull
1549+
| LangItem::RangeToInclusive,
15501550
_,
15511551
)
15521552
),

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ impl Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
132132
[segment]
133133
if segment
134134
.res
135-
.map(|res| matches!(res, Res::SelfTy(_, _) | Res::Def(hir::def::DefKind::TyParam, _)))
135+
.map(|res| {
136+
matches!(
137+
res,
138+
Res::SelfTy(_, _) | Res::Def(hir::def::DefKind::TyParam, _)
139+
)
140+
})
136141
.unwrap_or(false) =>
137142
{
138143
self.types.push(path.span);

compiler/rustc_middle/src/hir/map/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,9 @@ impl<'hir> Map<'hir> {
569569
self.find(self.get_parent_node(id)),
570570
Some(
571571
Node::Item(_)
572-
| Node::TraitItem(_)
573-
| Node::ImplItem(_)
574-
| Node::Expr(Expr { kind: ExprKind::Closure(..), .. }),
572+
| Node::TraitItem(_)
573+
| Node::ImplItem(_)
574+
| Node::Expr(Expr { kind: ExprKind::Closure(..), .. }),
575575
)
576576
)
577577
}

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,7 @@ impl<'tcx> LocalDecl<'tcx> {
962962
opt_ty_info: _,
963963
opt_match_place: _,
964964
pat_span: _,
965-
})
966-
| BindingForm::ImplicitSelf(ImplicitSelfKind::Imm),
965+
}) | BindingForm::ImplicitSelf(ImplicitSelfKind::Imm),
967966
)))
968967
)
969968
}
@@ -980,8 +979,7 @@ impl<'tcx> LocalDecl<'tcx> {
980979
opt_ty_info: _,
981980
opt_match_place: _,
982981
pat_span: _,
983-
})
984-
| BindingForm::ImplicitSelf(_),
982+
}) | BindingForm::ImplicitSelf(_),
985983
)))
986984
)
987985
}

compiler/rustc_middle/src/ty/diagnostics.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ impl<'tcx> TyS<'tcx> {
1212
pub fn is_primitive_ty(&self) -> bool {
1313
matches!(
1414
self.kind(),
15-
Bool | Char | Str | Int(_) | Uint(_) | Float(_)
16-
| Infer(
17-
InferTy::IntVar(_)
18-
| InferTy::FloatVar(_)
19-
| InferTy::FreshIntTy(_)
20-
| InferTy::FreshFloatTy(_)
21-
)
15+
Bool | Char
16+
| Str
17+
| Int(_)
18+
| Uint(_)
19+
| Float(_)
20+
| Infer(
21+
InferTy::IntVar(_)
22+
| InferTy::FloatVar(_)
23+
| InferTy::FreshIntTy(_)
24+
| InferTy::FreshFloatTy(_)
25+
)
2226
)
2327
}
2428

compiler/rustc_middle/src/ty/error.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -646,11 +646,14 @@ impl<T> Trait<T> for X {
646646
let current_method_ident = body_owner.and_then(|n| n.ident()).map(|i| i.name);
647647

648648
// We don't want to suggest calling an assoc fn in a scope where that isn't feasible.
649-
let callable_scope = matches!(body_owner, Some(
649+
let callable_scope = matches!(
650+
body_owner,
651+
Some(
650652
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn(..), .. })
651-
| hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. })
652-
| hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }),
653-
));
653+
| hir::Node::TraitItem(hir::TraitItem { kind: hir::TraitItemKind::Fn(..), .. })
654+
| hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(..), .. }),
655+
)
656+
);
654657
let impl_comparison = matches!(
655658
cause_code,
656659
ObligationCauseCode::CompareImplMethodObligation { .. }

0 commit comments

Comments
 (0)