Skip to content

Commit 3fd1af5

Browse files
committed
let rustfmt undo most of my edits :(
1 parent 9dee5d5 commit 3fd1af5

File tree

6 files changed

+17
-31
lines changed

6 files changed

+17
-31
lines changed

src/librustc/mir/interpret/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ impl<'tcx> ConstEvalErr<'tcx> {
137137
) -> Result<DiagnosticBuilder<'tcx>, ErrorHandled> {
138138
let must_error = match self.error {
139139
InterpError::MachineStop(_) => bug!("CTFE does not stop"),
140-
err_inval!(Layout(LayoutError::Unknown(_)))
141-
| err_inval!(TooGeneric) => {
140+
err_inval!(Layout(LayoutError::Unknown(_))) | err_inval!(TooGeneric) => {
142141
return Err(ErrorHandled::TooGeneric);
143142
}
144143
err_inval!(TypeckError) => return Err(ErrorHandled::Reported),

src/librustc_mir/interpret/cast.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,15 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
118118
}
119119
// The rest is integer/pointer-"like", including fn ptr casts and casts from enums that
120120
// are represented as integers.
121-
_ => {
122-
assert!(
123-
src.layout.ty.is_bool()
124-
|| src.layout.ty.is_char()
125-
|| src.layout.ty.is_enum()
126-
|| src.layout.ty.is_integral()
127-
|| src.layout.ty.is_any_ptr(),
128-
"Unexpected cast from type {:?}",
129-
src.layout.ty
130-
)
131-
}
121+
_ => assert!(
122+
src.layout.ty.is_bool()
123+
|| src.layout.ty.is_char()
124+
|| src.layout.ty.is_enum()
125+
|| src.layout.ty.is_integral()
126+
|| src.layout.ty.is_any_ptr(),
127+
"Unexpected cast from type {:?}",
128+
src.layout.ty
129+
),
132130
}
133131

134132
// Handle cast from a univariant (ZST) enum.

src/librustc_mir/interpret/eval_context.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,10 @@ impl<'tcx, Tag: Copy + 'static> LocalState<'tcx, Tag> {
152152
&mut self,
153153
) -> InterpResult<'tcx, Result<&mut LocalValue<Tag>, MemPlace<Tag>>> {
154154
match self.value {
155-
LocalValue::Dead => {
156-
throw_unsup!(DeadLocal)
157-
}
158-
LocalValue::Live(Operand::Indirect(mplace)) => {
159-
Ok(Err(mplace))
160-
}
155+
LocalValue::Dead => throw_unsup!(DeadLocal),
156+
LocalValue::Live(Operand::Indirect(mplace)) => Ok(Err(mplace)),
161157
ref mut local @ LocalValue::Live(Operand::Immediate(_))
162-
| ref mut local @ LocalValue::Uninitialized => {
163-
Ok(Ok(local))
164-
}
158+
| ref mut local @ LocalValue::Uninitialized => Ok(Ok(local)),
165159
}
166160
}
167161
}

src/librustc_mir/interpret/memory.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
580580
let layout = self.tcx.layout_of(ParamEnv::empty().and(ty)).unwrap();
581581
Ok((layout.size, layout.align.abi))
582582
}
583-
Some(GlobalAlloc::Memory(alloc)) =>
584-
{
583+
Some(GlobalAlloc::Memory(alloc)) => {
585584
// Need to duplicate the logic here, because the global allocations have
586585
// different associated types than the interpreter-local ones.
587586
Ok((alloc.size, alloc.align))

src/librustc_mir/interpret/operand.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
543543
| ty::ConstKind::Placeholder(..) => {
544544
bug!("eval_const_to_op: Unexpected ConstKind {:?}", val)
545545
}
546-
ty::ConstKind::Value(val_val) => {
547-
val_val
548-
}
546+
ty::ConstKind::Value(val_val) => val_val,
549547
};
550548
// Other cases need layout.
551549
let layout = from_known_layout(layout, || self.layout_of(val.ty))?;

src/librustc_mir/interpret/validity.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ fn write_path(out: &mut String, path: &Vec<PathElem>) {
114114
ClosureVar(name) => write!(out, ".<closure-var({})>", name),
115115
TupleElem(idx) => write!(out, ".{}", idx),
116116
ArrayElem(idx) => write!(out, "[{}]", idx),
117-
Deref =>
118-
{
117+
Deref => {
119118
// This does not match Rust syntax, but it is more readable for long paths -- and
120119
// some of the other items here also are not Rust syntax. Actually we can't
121120
// even use the usual syntax because we are just showing the projections,
@@ -206,8 +205,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
206205
ty::Adt(def, ..) if def.is_enum() => {
207206
// we might be projecting *to* a variant, or to a field *in*a variant.
208207
match layout.variants {
209-
layout::Variants::Single { index } =>
210-
{
208+
layout::Variants::Single { index } => {
211209
// Inside a variant
212210
PathElem::Field(def.variants[index].fields[field].ident.name)
213211
}

0 commit comments

Comments
 (0)