Skip to content

Commit 94867fb

Browse files
committed
use question mark operator
1 parent d74229b commit 94867fb

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)