@@ -7,7 +7,7 @@ use rustc_parse_format::{ParseMode, Parser, Piece};
77use rustc_session:: lint:: FutureIncompatibilityReason ;
88use rustc_session:: { declare_lint, declare_lint_pass} ;
99use rustc_span:: edition:: Edition ;
10- use rustc_span:: { InnerSpan , Span , Symbol , hygiene, kw , sym} ;
10+ use rustc_span:: { InnerSpan , Span , Symbol , hygiene, sym} ;
1111use rustc_trait_selection:: infer:: InferCtxtExt ;
1212
1313use crate :: lints:: { NonFmtPanicBraces , NonFmtPanicUnused } ;
@@ -167,7 +167,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
167167 . get_diagnostic_item ( sym:: Debug )
168168 . is_some_and ( |t| infcx. type_implements_trait ( t, [ ty] , param_env) . may_apply ( ) ) ;
169169
170- let suggest_panic_any = !is_str && panic == sym:: std_panic_macro;
170+ let suggest_panic_any = !is_str && panic == Some ( sym:: std_panic_macro) ;
171171
172172 let fmt_applicability = if suggest_panic_any {
173173 // If we can use panic_any, use that as the MachineApplicable suggestion.
@@ -297,10 +297,13 @@ fn find_delimiters(cx: &LateContext<'_>, span: Span) -> Option<(Span, Span, char
297297 ) )
298298}
299299
300- fn panic_call < ' tcx > ( cx : & LateContext < ' tcx > , f : & ' tcx hir:: Expr < ' tcx > ) -> ( Span , Symbol , Symbol ) {
300+ fn panic_call < ' tcx > (
301+ cx : & LateContext < ' tcx > ,
302+ f : & ' tcx hir:: Expr < ' tcx > ,
303+ ) -> ( Span , Option < Symbol > , Symbol ) {
301304 let mut expn = f. span . ctxt ( ) . outer_expn_data ( ) ;
302305
303- let mut panic_macro = kw :: Empty ;
306+ let mut panic_macro = None ;
304307
305308 // Unwrap more levels of macro expansion, as panic_2015!()
306309 // was likely expanded from panic!() and possibly from
@@ -320,7 +323,7 @@ fn panic_call<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>) -> (Span,
320323 break ;
321324 }
322325 expn = parent;
323- panic_macro = name;
326+ panic_macro = Some ( name) ;
324327 }
325328
326329 let macro_symbol =
0 commit comments