@@ -7,7 +7,7 @@ use rustc_parse_format::{ParseMode, Parser, Piece};
7
7
use rustc_session:: lint:: FutureIncompatibilityReason ;
8
8
use rustc_session:: { declare_lint, declare_lint_pass} ;
9
9
use rustc_span:: edition:: Edition ;
10
- use rustc_span:: { InnerSpan , Span , Symbol , hygiene, kw , sym} ;
10
+ use rustc_span:: { InnerSpan , Span , Symbol , hygiene, sym} ;
11
11
use rustc_trait_selection:: infer:: InferCtxtExt ;
12
12
13
13
use crate :: lints:: { NonFmtPanicBraces , NonFmtPanicUnused } ;
@@ -167,7 +167,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
167
167
. get_diagnostic_item ( sym:: Debug )
168
168
. is_some_and ( |t| infcx. type_implements_trait ( t, [ ty] , param_env) . may_apply ( ) ) ;
169
169
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) ;
171
171
172
172
let fmt_applicability = if suggest_panic_any {
173
173
// 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
297
297
) )
298
298
}
299
299
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 ) {
301
304
let mut expn = f. span . ctxt ( ) . outer_expn_data ( ) ;
302
305
303
- let mut panic_macro = kw :: Empty ;
306
+ let mut panic_macro = None ;
304
307
305
308
// Unwrap more levels of macro expansion, as panic_2015!()
306
309
// 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,
320
323
break ;
321
324
}
322
325
expn = parent;
323
- panic_macro = name;
326
+ panic_macro = Some ( name) ;
324
327
}
325
328
326
329
let macro_symbol =
0 commit comments