Skip to content

Commit 684f757

Browse files
committed
Make clippy-suggested fixes.
1 parent 53fa985 commit 684f757

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl<'tcx> fmt::Display for EvalError<'tcx> {
153153
EvalError::AlignmentCheckFailed { required, has } =>
154154
write!(f, "tried to access memory with alignment {}, but alignment {} is required",
155155
has, required),
156-
EvalError::TypeNotPrimitive(ref ty) =>
156+
EvalError::TypeNotPrimitive(ty) =>
157157
write!(f, "expected primitive type, got {}", ty),
158158
EvalError::Layout(ref err) =>
159159
write!(f, "rustc layout computation failed: {:?}", err),

src/eval_context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
332332
StackPopCleanup::None => {},
333333
}
334334
// deallocate all locals that are backed by an allocation
335-
for local in frame.locals.into_iter() {
335+
for local in frame.locals {
336336
if let Value::ByRef(ptr) = local {
337337
trace!("deallocating local");
338338
self.memory.dump_alloc(ptr.alloc_id);
@@ -1457,7 +1457,7 @@ impl IntegerExt for layout::Integer {
14571457

14581458

14591459
pub fn monomorphize_field_ty<'a, 'tcx:'a >(tcx: TyCtxt<'a, 'tcx, 'tcx>, f: &ty::FieldDef, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
1460-
let substituted = &f.ty(tcx, substs);
1460+
let substituted = f.ty(tcx, substs);
14611461
tcx.normalize_associated_type(&substituted)
14621462
}
14631463

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![feature(
22
btree_range,
33
collections,
4-
collections_bound,
54
field_init_shorthand,
65
i128_type,
76
pub_restricted,

src/terminator/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
579579
}
580580

581581
traits::VtableFnPointer(vtable_fn_ptr) => {
582-
if let ty::TyFnDef(did, ref substs, _) = vtable_fn_ptr.fn_ty.sty {
582+
if let ty::TyFnDef(did, substs, _) = vtable_fn_ptr.fn_ty.sty {
583583
args.remove(0);
584584
self.unpack_fn_args(args)?;
585585
Ok((did, substs, Vec::new()))
@@ -775,14 +775,14 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
775775
Ok(())
776776
}
777777

778-
fn drop_fields<
779-
I: Iterator<Item=(Ty<'tcx>, ty::layout::Size)>,
780-
>(
778+
fn drop_fields<I>(
781779
&mut self,
782780
mut fields: I,
783781
lval: Lvalue<'tcx>,
784782
drop: &mut Vec<(DefId, Value, &'tcx Substs<'tcx>)>,
785-
) -> EvalResult<'tcx, ()> {
783+
) -> EvalResult<'tcx, ()>
784+
where I: Iterator<Item = (Ty<'tcx>, ty::layout::Size)>,
785+
{
786786
// FIXME: some aggregates may be represented by Value::ByValPair
787787
let (adt_ptr, extra) = self.force_allocation(lval)?.to_ptr_and_extra();
788788
// manual iteration, because we need to be careful about the last field if it is unsized

src/vtable.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
2727
traits::VtableBuiltin(_) => {
2828
Vec::new().into_iter()
2929
}
30-
traits::VtableImpl(
31-
traits::VtableImplData {
32-
impl_def_id: id,
33-
substs,
34-
nested: _ }) => {
30+
31+
traits::VtableImpl(traits::VtableImplData { impl_def_id: id, substs, .. }) => {
3532
self.get_vtable_methods(id, substs)
3633
.into_iter()
3734
.map(|opt_mth| opt_mth.map(|mth| {
@@ -46,32 +43,35 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
4643
.collect::<Vec<_>>()
4744
.into_iter()
4845
}
46+
4947
traits::VtableClosure(
5048
traits::VtableClosureData {
5149
closure_def_id,
5250
substs,
53-
nested: _ }) => {
51+
..
52+
}
53+
) => {
5454
let closure_type = self.tcx.closure_type(closure_def_id, substs);
5555
vec![Some(self.memory.create_closure_ptr(self.tcx, closure_def_id, substs, closure_type))].into_iter()
5656
}
57-
traits::VtableFnPointer(
58-
traits::VtableFnPointerData {
59-
fn_ty,
60-
nested: _ }) => {
57+
58+
traits::VtableFnPointer(traits::VtableFnPointerData { fn_ty, .. }) => {
6159
match fn_ty.sty {
6260
ty::TyFnDef(did, substs, bare_fn_ty) => {
6361
vec![Some(self.memory.create_fn_ptr(self.tcx, did, substs, bare_fn_ty))].into_iter()
6462
},
6563
_ => bug!("bad VtableFnPointer fn_ty: {:?}", fn_ty),
6664
}
6765
}
66+
6867
traits::VtableObject(ref data) => {
6968
// this would imply that the Self type being erased is
7069
// an object type; this cannot happen because we
7170
// cannot cast an unsized type into a trait object
7271
bug!("cannot get vtable for an object type: {:?}",
7372
data);
7473
}
74+
7575
vtable @ traits::VtableParam(..) => {
7676
bug!("resolved vtable for {:?} to bad vtable {:?} in trans",
7777
trait_ref,
@@ -100,7 +100,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
100100
}
101101

102102
self.memory.write_usize(vtable.offset(ptr_size), size)?;
103-
self.memory.write_usize(vtable.offset((ptr_size * 2)), align)?;
103+
self.memory.write_usize(vtable.offset(ptr_size * 2), align)?;
104104

105105
for (i, method) in methods.into_iter().enumerate() {
106106
if let Some(method) = method {

0 commit comments

Comments
 (0)