Use expect instead of unwrap to make clippy happy

This commit is contained in:
Enrico Schmitz 2017-03-01 15:42:58 +01:00 committed by Enrico Schmitz
parent d4050c275e
commit 353945a01b

View file

@ -60,7 +60,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ArrayIndexing {
// Array with known size can be checked statically
let ty = cx.tables.expr_ty(array);
if let ty::TyArray(_, size) = ty.sty {
let size = ConstInt::Usize(ConstUsize::new(size as u64, cx.sess().target.uint_type).unwrap());
let size = ConstInt::Usize(ConstUsize::new(size as u64, cx.sess().target.uint_type).expect("array size is invalid"));
let constcx = ConstContext::with_tables(cx.tcx, cx.tables);
// Index is a constant uint