don't convert types to the same type with try_into (clippy::useless_conversion)

This commit is contained in:
Matthias Krüger 2020-09-15 22:44:43 +02:00
parent a874956d94
commit f567287f9f
3 changed files with 4 additions and 9 deletions

View file

@ -4,7 +4,6 @@ use rustc_middle::mir::*;
use rustc_middle::ty::{self, TyCtxt};
use smallvec::{smallvec, SmallVec};
use std::convert::TryInto;
use std::mem;
use super::abs_domain::Lift;
@ -482,10 +481,8 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
let base_ty = base_place.ty(self.builder.body, self.builder.tcx).ty;
let len: u64 = match base_ty.kind() {
ty::Array(_, size) => {
let length = size.eval_usize(self.builder.tcx, self.builder.param_env);
let length: u64 = size.eval_usize(self.builder.tcx, self.builder.param_env);
length
.try_into()
.expect("slice pattern of array with more than u32::MAX elements")
}
_ => bug!("from_end: false slice pattern of non-array type"),
};