Fix Clippy sync fallout

This commit is contained in:
flip1995 2022-01-13 13:37:24 +01:00
parent fb0142ae41
commit 7e267c23d6

View file

@ -191,13 +191,13 @@ impl<'a> PanicExpn<'a> {
if !macro_backtrace(expr.span).any(|macro_call| is_panic(cx, macro_call.def_id)) { if !macro_backtrace(expr.span).any(|macro_call| is_panic(cx, macro_call.def_id)) {
return None; return None;
} }
let ExprKind::Call(callee, [arg]) = expr.kind else { return None }; let ExprKind::Call(callee, [arg]) = &expr.kind else { return None };
let ExprKind::Path(QPath::Resolved(_, path)) = callee.kind else { return None }; let ExprKind::Path(QPath::Resolved(_, path)) = &callee.kind else { return None };
let result = match path.segments.last().unwrap().ident.as_str() { let result = match path.segments.last().unwrap().ident.as_str() {
"panic" if arg.span.ctxt() == expr.span.ctxt() => Self::Empty, "panic" if arg.span.ctxt() == expr.span.ctxt() => Self::Empty,
"panic" | "panic_str" => Self::Str(arg), "panic" | "panic_str" => Self::Str(arg),
"panic_display" => { "panic_display" => {
let ExprKind::AddrOf(_, _, e) = arg.kind else { return None }; let ExprKind::AddrOf(_, _, e) = &arg.kind else { return None };
Self::Display(e) Self::Display(e)
}, },
"panic_fmt" => Self::Format(FormatArgsExpn::parse(cx, arg)?), "panic_fmt" => Self::Format(FormatArgsExpn::parse(cx, arg)?),