Address clippy lints
This commit is contained in:
parent
df9440d5ac
commit
538c271e05
4 changed files with 7 additions and 11 deletions
|
@ -1285,9 +1285,9 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
|||
ty::TyRef(_, ref tam) |
|
||||
ty::TyRawPtr(ref tam) if self.type_is_sized(tam.ty) => PrimValKind::Ptr,
|
||||
|
||||
ty::TyAdt(ref def, _) if def.is_box() => PrimValKind::Ptr,
|
||||
ty::TyAdt(def, _) if def.is_box() => PrimValKind::Ptr,
|
||||
|
||||
ty::TyAdt(ref def, substs) => {
|
||||
ty::TyAdt(def, substs) => {
|
||||
use rustc::ty::layout::Layout::*;
|
||||
match *self.type_layout(ty)? {
|
||||
CEnum { discr, signed, .. } => {
|
||||
|
@ -1954,12 +1954,8 @@ pub fn needs_drop_glue<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, t: Ty<'tcx>) -> bo
|
|||
if !typ.needs_drop(tcx, &env) && type_is_sized(tcx, typ) {
|
||||
tcx.infer_ctxt((), traits::Reveal::All).enter(|infcx| {
|
||||
let layout = t.layout(&infcx).unwrap();
|
||||
if layout.size(&tcx.data_layout).bytes() == 0 {
|
||||
// `Box<ZeroSizeType>` does not allocate.
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
// `Box<ZeroSizeType>` does not allocate.
|
||||
layout.size(&tcx.data_layout).bytes() != 0
|
||||
})
|
||||
} else {
|
||||
true
|
||||
|
|
|
@ -322,7 +322,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
|||
let pointee_type = match base_ty.sty {
|
||||
ty::TyRawPtr(ref tam) |
|
||||
ty::TyRef(_, ref tam) => tam.ty,
|
||||
ty::TyAdt(ref def, _) if def.is_box() => base_ty.boxed_ty(),
|
||||
ty::TyAdt(def, _) if def.is_box() => base_ty.boxed_ty(),
|
||||
_ => bug!("can only deref pointer types"),
|
||||
};
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ impl<'a, 'tcx> Memory<'a, 'tcx> {
|
|||
if size == 0 {
|
||||
return Ok(Pointer::zst_ptr());
|
||||
}
|
||||
assert!(align != 0);
|
||||
assert_ne!(align, 0);
|
||||
|
||||
if self.memory_size - self.memory_usage < size {
|
||||
return Err(EvalError::OutOfMemory {
|
||||
|
|
|
@ -298,7 +298,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
|||
let pointee_type = match ty.sty {
|
||||
ty::TyRawPtr(ref tam) |
|
||||
ty::TyRef(_, ref tam) => tam.ty,
|
||||
ty::TyAdt(ref def, _) if def.is_box() => ty.boxed_ty(),
|
||||
ty::TyAdt(def, _) if def.is_box() => ty.boxed_ty(),
|
||||
_ => bug!("can only deref pointer types"),
|
||||
};
|
||||
self.drop(val, instance, pointee_type, span)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue