1
Fork 0

Merge pull request #10 from llogiq/clippy

Fixed some clippy warnings
This commit is contained in:
Scott Olson 2016-04-29 11:48:00 -06:00
commit 71bdabcdd9
2 changed files with 6 additions and 8 deletions

View file

@ -830,7 +830,7 @@ impl<'a, 'tcx: 'a, 'arena> Interpreter<'a, 'tcx, 'arena> {
Index(ref operand) => {
let elem_size = match base_ty.sty {
ty::TyArray(elem_ty, _) => self.type_size(elem_ty),
ty::TyArray(elem_ty, _) |
ty::TySlice(elem_ty) => self.type_size(elem_ty),
_ => panic!("indexing expected an array or slice, got {:?}", base_ty),
};
@ -1109,11 +1109,9 @@ impl<'a, 'tcx: 'a, 'arena> Interpreter<'a, 'tcx, 'arena> {
let vtable = selection.map(|predicate| {
fulfill_cx.register_predicate_obligation(&infcx, predicate);
});
let vtable = infer::drain_fulfillment_cx_or_panic(
infer::drain_fulfillment_cx_or_panic(
DUMMY_SP, &infcx, &mut fulfill_cx, &vtable
);
vtable
)
}
/// Trait method, which has to be resolved to an impl method.
@ -1166,7 +1164,7 @@ impl<'a, 'tcx: 'a, 'arena> Interpreter<'a, 'tcx, 'arena> {
}
}
fn pointee_type<'tcx>(ptr_ty: ty::Ty<'tcx>) -> Option<ty::Ty<'tcx>> {
fn pointee_type(ptr_ty: ty::Ty) -> Option<ty::Ty> {
match ptr_ty.sty {
ty::TyRef(_, ty::TypeAndMut { ty, .. }) |
ty::TyRawPtr(ty::TypeAndMut { ty, .. }) |

View file

@ -47,7 +47,7 @@ pub struct FieldRepr {
impl Repr {
pub fn size(&self) -> usize {
match *self {
Repr::Primitive { size } => size,
Repr::Primitive { size } |
Repr::Aggregate { size, .. } => size,
Repr::Array { elem_size, length } => elem_size * length,
}
@ -406,7 +406,7 @@ impl Memory {
fn clear_relocations(&mut self, ptr: Pointer, size: usize) -> EvalResult<()> {
// Find all relocations overlapping the given range.
let keys: Vec<_> = try!(self.relocations(ptr, size)).map(|(&k, _)| k).collect();
if keys.len() == 0 { return Ok(()); }
if keys.is_empty() { return Ok(()); }
// Find the start and end of the given range and its outermost relocations.
let start = ptr.offset;