mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
Auto merge of #8167 - rust-lang:fix-8166, r=xFredNet
fix an ICE on unwrapping a None This very likely fixes #8166 though I wasn't able to meaningfully reduce a test case. This line is the only call to `unwrap` within that function, which was the one in the stack trace that triggered the ICE, so I think we'll be OK. `@hackmad` can you pull and build this branch and check if it indeed fixes your problem? --- changelog: Fixed ICE in [`unnecessary_cast`]
This commit is contained in:
commit
547efad945
1 changed files with 3 additions and 2 deletions
|
@ -49,8 +49,9 @@ pub(super) fn check(
|
|||
if cast_from.kind() == cast_to.kind() =>
|
||||
{
|
||||
if let Some(src) = snippet_opt(cx, lit.span) {
|
||||
let num_lit = NumericLiteral::from_lit_kind(&src, &lit.node).unwrap();
|
||||
lint_unnecessary_cast(cx, expr, num_lit.integer, cast_from, cast_to);
|
||||
if let Some(num_lit) = NumericLiteral::from_lit_kind(&src, &lit.node) {
|
||||
lint_unnecessary_cast(cx, expr, num_lit.integer, cast_from, cast_to);
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
|
|
Loading…
Reference in a new issue