From 21c52c70b3d8abb9d3995e473ee120a11f3649ff Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Wed, 8 Aug 2018 12:45:34 +0200 Subject: [PATCH] Rustfmt --- src/base.rs | 35 +++++++++++++++++++++++++++-------- src/common.rs | 5 ++++- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/base.rs b/src/base.rs index b232d6948f8..d40c2ec20cd 100644 --- a/src/base.rs +++ b/src/base.rs @@ -357,7 +357,7 @@ fn trans_stmt<'a, 'tcx: 'a>( TypeVariants::TyInt(_) => { let zero = fx.bcx.ins().iconst(types::I64, 0); fx.bcx.ins().isub(zero, val) - }, + } TypeVariants::TyFloat(_) => fx.bcx.ins().fneg(val), _ => unimplemented!("un op Neg for {:?}", ty), }, @@ -422,11 +422,15 @@ fn trans_stmt<'a, 'tcx: 'a>( Rvalue::Len(lval) => return Err(format!("rval len {:?}", lval)), Rvalue::NullaryOp(NullOp::Box, ty) => unimplemented!("rval box {:?}", ty), Rvalue::NullaryOp(NullOp::SizeOf, ty) => { - assert!(lval.layout().ty.is_sized(fx.tcx.at(DUMMY_SP), ParamEnv::reveal_all())); + assert!( + lval.layout() + .ty + .is_sized(fx.tcx.at(DUMMY_SP), ParamEnv::reveal_all()) + ); let ty_size = fx.layout_of(ty).size.bytes(); let val = CValue::const_val(fx, fx.tcx.types.usize, ty_size as i64); lval.write_cvalue(fx, val); - }, + } Rvalue::Aggregate(_, _) => bug!("shouldn't exist at trans {:?}", rval), } } @@ -602,7 +606,11 @@ pub fn trans_int_binop<'a, 'tcx: 'a>( signed: bool, ) -> CValue<'tcx> { if bin_op != BinOp::Shl && bin_op != BinOp::Shr { - assert_eq!(lhs.layout().ty, rhs.layout().ty, "int binop requires lhs and rhs of same type"); + assert_eq!( + lhs.layout().ty, + rhs.layout().ty, + "int binop requires lhs and rhs of same type" + ); } binop_match! { fx, bin_op, signed, lhs, rhs, out_ty, "int/uint"; @@ -644,11 +652,18 @@ pub fn trans_checked_int_binop<'a, 'tcx: 'a>( signed: bool, ) -> CValue<'tcx> { if bin_op != BinOp::Shl && bin_op != BinOp::Shr { - assert_eq!(lhs.layout().ty, rhs.layout().ty, "checked int binop requires lhs and rhs of same type"); + assert_eq!( + lhs.layout().ty, + rhs.layout().ty, + "checked int binop requires lhs and rhs of same type" + ); } let res_ty = match out_ty.sty { TypeVariants::TyTuple(tys) => tys[0], - _ => bug!("Checked int binop requires tuple as output, but got {:?}", out_ty), + _ => bug!( + "Checked int binop requires tuple as output, but got {:?}", + out_ty + ), }; let res = binop_match! { @@ -679,9 +694,13 @@ pub fn trans_checked_int_binop<'a, 'tcx: 'a>( let has_overflow = CValue::const_val(fx, fx.tcx.types.bool, 0); let out_place = CPlace::temp(fx, out_ty); - out_place.place_field(fx, mir::Field::new(0)).write_cvalue(fx, res); + out_place + .place_field(fx, mir::Field::new(0)) + .write_cvalue(fx, res); println!("abc"); - out_place.place_field(fx, mir::Field::new(1)).write_cvalue(fx, has_overflow); + out_place + .place_field(fx, mir::Field::new(1)) + .write_cvalue(fx, has_overflow); out_place.to_cvalue(fx) } diff --git a/src/common.rs b/src/common.rs index c3398a9e9f3..35a41dd8a6f 100644 --- a/src/common.rs +++ b/src/common.rs @@ -303,7 +303,10 @@ impl<'a, 'tcx: 'a> CPlace<'tcx> { match layout.ty.sty { TypeVariants::TyArray(elem_ty, _) => { let elem_layout = fx.layout_of(elem_ty); - let size = fx.bcx.ins().iconst(types::I64, elem_layout.size.bytes() as i64); + let size = fx + .bcx + .ins() + .iconst(types::I64, elem_layout.size.bytes() as i64); let offset = fx.bcx.ins().imul(size, index); CPlace::Addr(fx.bcx.ins().iadd(addr, offset), elem_layout) }