@@ -102,9 +102,9 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
102
102
103
103
ControlFlow::CONTINUE
104
104
}
105
- Node::Binop(_, _, _)
106
- | Node::UnaryOp(_, _)
107
- | Node::FunctionCall(_, _) => ControlFlow::CONTINUE,
105
+ Node::Binop(_, _, _) | Node::UnaryOp(_, _) | Node::FunctionCall(_, _) => {
106
+ ControlFlow::CONTINUE
107
+ }
108
108
});
109
109
110
110
match failure_kind {
@@ -348,8 +348,8 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
348
348
&ExprKind::PlaceTypeAscription { source, .. } |
349
349
&ExprKind::ValueTypeAscription { source, .. } => self.recurse_build(source)?,
350
350
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`
353
353
&ExprKind::Literal { literal, .. }
354
354
| &ExprKind::StaticRef { literal, .. } => self.add_node(Node::Leaf(literal), node.span),
355
355
@@ -381,10 +381,10 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
381
381
// }
382
382
// ```
383
383
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
385
385
// "coercion cast" i.e. using a coercion or is a no-op.
386
386
// this is important so that `N as usize as usize` doesnt unify with `N as usize`
387
- &ExprKind::Use { source}
387
+ &ExprKind::Use { source}
388
388
| &ExprKind::Cast { source } => {
389
389
let arg = self.recurse_build(source)?;
390
390
self.add_node(Node::Cast(arg, node.ty), node.span)
@@ -404,7 +404,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
404
404
| ExprKind::Field { .. }
405
405
| ExprKind::ConstBlock { .. }
406
406
| ExprKind::Adt(_) => return self.error(
407
- Some(node.span),
407
+ Some(node.span),
408
408
"unsupported operation in generic constant, this may be supported in the future",
409
409
).map(|never| never),
410
410
@@ -417,7 +417,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
417
417
| ExprKind::Assign { .. }
418
418
| ExprKind::LogicalOp { .. }
419
419
| ExprKind::Unary { .. } //
420
- | ExprKind::Binary { .. } // we handle valid unary/binary ops above
420
+ | ExprKind::Binary { .. } // we handle valid unary/binary ops above
421
421
| ExprKind::Break { .. }
422
422
| ExprKind::Continue { .. }
423
423
| ExprKind::If { .. }
@@ -592,16 +592,14 @@ pub(super) fn try_unify<'tcx>(
592
592
&& iter::zip(a_args, b_args)
593
593
.all(|(&an, &bn)| try_unify(tcx, a.subtree(an), b.subtree(bn)))
594
594
}
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) => {
598
596
try_unify(tcx, a.subtree(a_operand), b.subtree(b_operand))
599
597
}
600
598
// 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(..), _)
605
603
| (Node::Leaf(..), _) => false,
606
604
}
607
605
}
0 commit comments