mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-16 22:16:53 +00:00
Prefer .ok()?
over .unwrap()
This commit is contained in:
parent
6e1df4732b
commit
75ed0c9f26
@ -107,7 +107,7 @@ fn check_for_positive_int_constant<'a>(cx: &'a LateContext<'_>, expr: &'a Expr<'
|
||||
|
||||
if int_const > FullInt::S(0) {
|
||||
let val = match int_const {
|
||||
FullInt::S(s) => s.try_into().unwrap(),
|
||||
FullInt::S(s) => s.try_into().ok()?,
|
||||
FullInt::U(u) => u,
|
||||
};
|
||||
Some((val, other_op))
|
||||
|
Loading…
Reference in New Issue
Block a user