diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index ceda5d1a7c3..ec8ba70bf74 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -231,13 +231,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { ExprKind::Tup(ref tup) => self.multi(tup).map(Constant::Tuple), ExprKind::Repeat(ref value, _) => { let n = match self.tables.expr_ty(e).kind { - ty::Array(_, n) => { - if let Some(n) = n.try_eval_usize(self.lcx.tcx, self.lcx.param_env) { - n - } else { - return None; - } - }, + ty::Array(_, n) => n.try_eval_usize(self.lcx.tcx, self.lcx.param_env)?, _ => span_bug!(e.span, "typeck error"), }; self.expr(value).map(|v| Constant::Repeat(Box::new(v), n))