Skip to content

Commit 71bdabc

Browse files
committed
Merge pull request #10 from llogiq/clippy
Fixed some clippy warnings
2 parents 1531bd6 + 7cb6c0d commit 71bdabc

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/interpreter.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ impl<'a, 'tcx: 'a, 'arena> Interpreter<'a, 'tcx, 'arena> {
830830

831831
Index(ref operand) => {
832832
let elem_size = match base_ty.sty {
833-
ty::TyArray(elem_ty, _) => self.type_size(elem_ty),
833+
ty::TyArray(elem_ty, _) |
834834
ty::TySlice(elem_ty) => self.type_size(elem_ty),
835835
_ => panic!("indexing expected an array or slice, got {:?}", base_ty),
836836
};
@@ -1109,11 +1109,9 @@ impl<'a, 'tcx: 'a, 'arena> Interpreter<'a, 'tcx, 'arena> {
11091109
let vtable = selection.map(|predicate| {
11101110
fulfill_cx.register_predicate_obligation(&infcx, predicate);
11111111
});
1112-
let vtable = infer::drain_fulfillment_cx_or_panic(
1112+
infer::drain_fulfillment_cx_or_panic(
11131113
DUMMY_SP, &infcx, &mut fulfill_cx, &vtable
1114-
);
1115-
1116-
vtable
1114+
)
11171115
}
11181116

11191117
/// Trait method, which has to be resolved to an impl method.
@@ -1166,7 +1164,7 @@ impl<'a, 'tcx: 'a, 'arena> Interpreter<'a, 'tcx, 'arena> {
11661164
}
11671165
}
11681166

1169-
fn pointee_type<'tcx>(ptr_ty: ty::Ty<'tcx>) -> Option<ty::Ty<'tcx>> {
1167+
fn pointee_type(ptr_ty: ty::Ty) -> Option<ty::Ty> {
11701168
match ptr_ty.sty {
11711169
ty::TyRef(_, ty::TypeAndMut { ty, .. }) |
11721170
ty::TyRawPtr(ty::TypeAndMut { ty, .. }) |

src/memory.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub struct FieldRepr {
4747
impl Repr {
4848
pub fn size(&self) -> usize {
4949
match *self {
50-
Repr::Primitive { size } => size,
50+
Repr::Primitive { size } |
5151
Repr::Aggregate { size, .. } => size,
5252
Repr::Array { elem_size, length } => elem_size * length,
5353
}
@@ -406,7 +406,7 @@ impl Memory {
406406
fn clear_relocations(&mut self, ptr: Pointer, size: usize) -> EvalResult<()> {
407407
// Find all relocations overlapping the given range.
408408
let keys: Vec<_> = try!(self.relocations(ptr, size)).map(|(&k, _)| k).collect();
409-
if keys.len() == 0 { return Ok(()); }
409+
if keys.is_empty() { return Ok(()); }
410410

411411
// Find the start and end of the given range and its outermost relocations.
412412
let start = ptr.offset;

0 commit comments

Comments
 (0)