Skip to content

Commit 66751ea

Browse files
tidy
rustfmt, pleaaaaase, start supporting rust Co-authored-by: nils <[email protected]>
1 parent 09485ea commit 66751ea

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

compiler/rustc_const_eval/src/transform/promote_consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
847847
let local_decls = &mut self.source.local_decls;
848848
let loc = candidate.location;
849849
let statement = &mut blocks[loc.block].statements[loc.statement_index];
850-
let StatementKind::Assign(box (_, Rvalue::Ref(region, borrow_kind, place)))= &mut statement.kind else {
850+
let StatementKind::Assign(box (_, Rvalue::Ref(region, borrow_kind, place))) = &mut statement.kind else {
851851
bug!()
852852
};
853853

compiler/rustc_mir_build/src/build/expr/stmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
113113
//
114114
// it is usually better to focus on `the_value` rather
115115
// than the entirety of block(s) surrounding it.
116-
let adjusted_span =
116+
let adjusted_span =
117117
if let ExprKind::Block { block } = expr.kind
118118
&& let Some(tail_ex) = this.thir[block].expr
119119
{

compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs

+15-16
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,22 @@ impl IntRange {
141141
) -> Option<IntRange> {
142142
let ty = value.ty();
143143
if let Some((target_size, bias)) = Self::integral_size_and_signed_bias(tcx, ty) {
144-
let val =
145-
if let mir::ConstantKind::Val(ConstValue::Scalar(scalar), _) = value {
146-
// For this specific pattern we can skip a lot of effort and go
147-
// straight to the result, after doing a bit of checking. (We
148-
// could remove this branch and just fall through, which
149-
// is more general but much slower.)
150-
scalar.to_bits_or_ptr_internal(target_size).unwrap().left()?
151-
} else {
152-
if let mir::ConstantKind::Ty(c) = value
153-
&& let ty::ConstKind::Value(_) = c.kind()
154-
{
155-
bug!("encountered ConstValue in mir::ConstantKind::Ty, whereas this is expected to be in ConstantKind::Val");
156-
}
144+
let val = if let mir::ConstantKind::Val(ConstValue::Scalar(scalar), _) = value {
145+
// For this specific pattern we can skip a lot of effort and go
146+
// straight to the result, after doing a bit of checking. (We
147+
// could remove this branch and just fall through, which
148+
// is more general but much slower.)
149+
scalar.to_bits_or_ptr_internal(target_size).unwrap().left()?
150+
} else {
151+
if let mir::ConstantKind::Ty(c) = value
152+
&& let ty::ConstKind::Value(_) = c.kind()
153+
{
154+
bug!("encountered ConstValue in mir::ConstantKind::Ty, whereas this is expected to be in ConstantKind::Val");
155+
}
157156

158-
// This is a more general form of the previous case.
159-
value.try_eval_bits(tcx, param_env, ty)?
160-
};
157+
// This is a more general form of the previous case.
158+
value.try_eval_bits(tcx, param_env, ty)?
159+
};
161160
let val = val ^ bias;
162161
Some(IntRange { range: val..=val, bias })
163162
} else {

0 commit comments

Comments
 (0)