Skip to content

Commit e4d688c

Browse files
committed
Auto merge of #5261 - matthiaskrgr:qmark, r=flip1995
use question mark operator changelog: none
2 parents d74229b + 94867fb commit e4d688c

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

clippy_lints/src/consts.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
231231
ExprKind::Tup(ref tup) => self.multi(tup).map(Constant::Tuple),
232232
ExprKind::Repeat(ref value, _) => {
233233
let n = match self.tables.expr_ty(e).kind {
234-
ty::Array(_, n) => {
235-
if let Some(n) = n.try_eval_usize(self.lcx.tcx, self.lcx.param_env) {
236-
n
237-
} else {
238-
return None;
239-
}
240-
},
234+
ty::Array(_, n) => n.try_eval_usize(self.lcx.tcx, self.lcx.param_env)?,
241235
_ => span_bug!(e.span, "typeck error"),
242236
};
243237
self.expr(value).map(|v| Constant::Repeat(Box::new(v), n))

0 commit comments

Comments
 (0)