Skip to content

Commit c170dcf

Browse files
committed
tidy
1 parent 47b16f4 commit c170dcf

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

compiler/rustc_privacy/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ where
159159
self.visit_const(leaf)
160160
}
161161
ACNode::Cast(_, ty) => self.visit_ty(ty),
162-
ACNode::Binop(..)
163-
| ACNode::UnaryOp(..)
164-
| ACNode::FunctionCall(_, _) => ControlFlow::CONTINUE,
162+
ACNode::Binop(..) | ACNode::UnaryOp(..) | ACNode::FunctionCall(_, _) => {
163+
ControlFlow::CONTINUE
164+
}
165165
})
166166
}
167167

compiler/rustc_trait_selection/src/traits/const_evaluatable.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
102102

103103
ControlFlow::CONTINUE
104104
}
105-
Node::Binop(_, _, _)
106-
| Node::UnaryOp(_, _)
107-
| Node::FunctionCall(_, _) => ControlFlow::CONTINUE,
105+
Node::Binop(_, _, _) | Node::UnaryOp(_, _) | Node::FunctionCall(_, _) => {
106+
ControlFlow::CONTINUE
107+
}
108108
});
109109

110110
match failure_kind {
@@ -348,8 +348,8 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
348348
&ExprKind::PlaceTypeAscription { source, .. } |
349349
&ExprKind::ValueTypeAscription { source, .. } => self.recurse_build(source)?,
350350

351-
// subtle: associated consts are literals this arm handles
352-
// `<T as Trait>::ASSOC` as well as `12`
351+
// subtle: associated consts are literals this arm handles
352+
// `<T as Trait>::ASSOC` as well as `12`
353353
&ExprKind::Literal { literal, .. }
354354
| &ExprKind::StaticRef { literal, .. } => self.add_node(Node::Leaf(literal), node.span),
355355

@@ -381,10 +381,10 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
381381
// }
382382
// ```
383383
ExprKind::Block { body: thir::Block { stmts: box [], expr: Some(e), .. }} => self.recurse_build(*e)?,
384-
// ExprKind::Use happens when a `hir::ExprKind::Cast` is a
384+
// ExprKind::Use happens when a `hir::ExprKind::Cast` is a
385385
// "coercion cast" i.e. using a coercion or is a no-op.
386386
// this is important so that `N as usize as usize` doesnt unify with `N as usize`
387-
&ExprKind::Use { source}
387+
&ExprKind::Use { source}
388388
| &ExprKind::Cast { source } => {
389389
let arg = self.recurse_build(source)?;
390390
self.add_node(Node::Cast(arg, node.ty), node.span)
@@ -404,7 +404,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
404404
| ExprKind::Field { .. }
405405
| ExprKind::ConstBlock { .. }
406406
| ExprKind::Adt(_) => return self.error(
407-
Some(node.span),
407+
Some(node.span),
408408
"unsupported operation in generic constant, this may be supported in the future",
409409
).map(|never| never),
410410

@@ -417,7 +417,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
417417
| ExprKind::Assign { .. }
418418
| ExprKind::LogicalOp { .. }
419419
| ExprKind::Unary { .. } //
420-
| ExprKind::Binary { .. } // we handle valid unary/binary ops above
420+
| ExprKind::Binary { .. } // we handle valid unary/binary ops above
421421
| ExprKind::Break { .. }
422422
| ExprKind::Continue { .. }
423423
| ExprKind::If { .. }
@@ -592,16 +592,14 @@ pub(super) fn try_unify<'tcx>(
592592
&& iter::zip(a_args, b_args)
593593
.all(|(&an, &bn)| try_unify(tcx, a.subtree(an), b.subtree(bn)))
594594
}
595-
(Node::Cast(a_operand, a_ty), Node::Cast(b_operand, b_ty))
596-
if (a_ty == b_ty) =>
597-
{
595+
(Node::Cast(a_operand, a_ty), Node::Cast(b_operand, b_ty)) if (a_ty == b_ty) => {
598596
try_unify(tcx, a.subtree(a_operand), b.subtree(b_operand))
599597
}
600598
// use this over `_ => false` to make adding variants to `Node` less error prone
601-
(Node::Cast(..), _)
602-
| (Node::FunctionCall(..), _)
603-
| (Node::UnaryOp(..), _)
604-
| (Node::Binop(..), _)
599+
(Node::Cast(..), _)
600+
| (Node::FunctionCall(..), _)
601+
| (Node::UnaryOp(..), _)
602+
| (Node::Binop(..), _)
605603
| (Node::Leaf(..), _) => false,
606604
}
607605
}

compiler/rustc_trait_selection/src/traits/object_safety.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -844,9 +844,9 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
844844
self.visit_const(leaf)
845845
}
846846
Node::Cast(_, ty) => self.visit_ty(ty),
847-
Node::Binop(..)
848-
| Node::UnaryOp(..)
849-
| Node::FunctionCall(_, _) => ControlFlow::CONTINUE,
847+
Node::Binop(..) | Node::UnaryOp(..) | Node::FunctionCall(_, _) => {
848+
ControlFlow::CONTINUE
849+
}
850850
})
851851
} else {
852852
ControlFlow::CONTINUE

0 commit comments

Comments
 (0)