Skip to content

Commit

Permalink
Auto merge of #5261 - matthiaskrgr:qmark, r=flip1995
Browse files Browse the repository at this point in the history
use question mark operator

changelog: none
  • Loading branch information
bors committed Mar 3, 2020
2 parents d74229b + 94867fb commit e4d688c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions clippy_lints/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit e4d688c

Please sign in to comment.