Format all the let chains in compiler

This commit is contained in:
Michael Goulet 2023-10-13 08:58:33 +00:00
parent 2763ca50da
commit b2d2184ede
206 changed files with 3120 additions and 2228 deletions

View file

@ -456,7 +456,8 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
Rvalue::Aggregate(kind, ..) => {
if let AggregateKind::Generator(def_id, ..) = kind.as_ref()
&& let Some(generator_kind @ hir::GeneratorKind::Async(..)) = self.tcx.generator_kind(def_id)
&& let Some(generator_kind @ hir::GeneratorKind::Async(..)) =
self.tcx.generator_kind(def_id)
{
self.check_op(ops::Generator(generator_kind));
}
@ -571,8 +572,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
}
}
Rvalue::BinaryOp(op, box (lhs, rhs))
| Rvalue::CheckedBinaryOp(op, box (lhs, rhs)) => {
Rvalue::BinaryOp(op, box (lhs, rhs)) | Rvalue::CheckedBinaryOp(op, box (lhs, rhs)) => {
let lhs_ty = lhs.ty(self.body, self.tcx);
let rhs_ty = rhs.ty(self.body, self.tcx);
@ -580,18 +580,16 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
// Int, bool, and char operations are fine.
} else if lhs_ty.is_fn_ptr() || lhs_ty.is_unsafe_ptr() {
assert_eq!(lhs_ty, rhs_ty);
assert!(
matches!(
op,
BinOp::Eq
assert!(matches!(
op,
BinOp::Eq
| BinOp::Ne
| BinOp::Le
| BinOp::Lt
| BinOp::Ge
| BinOp::Gt
| BinOp::Offset
)
);
));
self.check_op(ops::RawPtrComparison);
} else if lhs_ty.is_floating_point() || rhs_ty.is_floating_point() {
@ -939,7 +937,9 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
if self.span.allows_unstable(gate) {
return;
}
if let Some(implied_by_gate) = implied_by && self.span.allows_unstable(implied_by_gate) {
if let Some(implied_by_gate) = implied_by
&& self.span.allows_unstable(implied_by_gate)
{
return;
}

View file

@ -311,10 +311,10 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
ccx.const_kind(),
));
if let Some(feature) = feature && ccx.tcx.sess.is_nightly_build() {
err.help(format!(
"add `#![feature({feature})]` to the crate attributes to enable",
));
if let Some(feature) = feature
&& ccx.tcx.sess.is_nightly_build()
{
err.help(format!("add `#![feature({feature})]` to the crate attributes to enable",));
}
if let ConstContext::Static(_) = ccx.const_kind() {