@@ -9,7 +9,7 @@ use rustc_middle::ty::subst::InternalSubsts;
9
9
use rustc_parse_format:: { ParseMode , Parser , Piece } ;
10
10
use rustc_session:: lint:: FutureIncompatibilityReason ;
11
11
use rustc_span:: edition:: Edition ;
12
- use rustc_span:: { hygiene, sym, symbol:: kw, symbol :: SymbolStr , InnerSpan , Span , Symbol } ;
12
+ use rustc_span:: { hygiene, sym, symbol:: kw, InnerSpan , Span , Symbol } ;
13
13
use rustc_trait_selection:: infer:: InferCtxtExt ;
14
14
15
15
declare_lint ! {
@@ -78,7 +78,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
78
78
79
79
// The argument is *not* a string literal.
80
80
81
- let ( span, panic, symbol_str ) = panic_call ( cx, f) ;
81
+ let ( span, panic, symbol ) = panic_call ( cx, f) ;
82
82
83
83
if in_external_macro ( cx. sess ( ) , span) {
84
84
// Nothing that can be done about it in the current crate.
@@ -103,7 +103,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
103
103
104
104
cx. struct_span_lint ( NON_FMT_PANICS , arg_span, |lint| {
105
105
let mut l = lint. build ( "panic message is not a string literal" ) ;
106
- l. note ( & format ! ( "this usage of {}!() is deprecated; it will be a hard error in Rust 2021" , symbol_str ) ) ;
106
+ l. note ( & format ! ( "this usage of {}!() is deprecated; it will be a hard error in Rust 2021" , symbol ) ) ;
107
107
l. note ( "for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>" ) ;
108
108
if !is_arg_inside_call ( arg_span, span) {
109
109
// No clue where this argument is coming from.
@@ -112,7 +112,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
112
112
}
113
113
if arg_macro. map_or ( false , |id| cx. tcx . is_diagnostic_item ( sym:: format_macro, id) ) {
114
114
// A case of `panic!(format!(..))`.
115
- l. note ( format ! ( "the {}!() macro supports formatting, so there's no need for the format!() macro here" , symbol_str ) . as_str ( ) ) ;
115
+ l. note ( format ! ( "the {}!() macro supports formatting, so there's no need for the format!() macro here" , symbol ) . as_str ( ) ) ;
116
116
if let Some ( ( open, close, _) ) = find_delimiters ( cx, arg_span) {
117
117
l. multipart_suggestion (
118
118
"remove the `format!(..)` macro call" ,
@@ -301,7 +301,7 @@ fn find_delimiters<'tcx>(cx: &LateContext<'tcx>, span: Span) -> Option<(Span, Sp
301
301
) )
302
302
}
303
303
304
- fn panic_call < ' tcx > ( cx : & LateContext < ' tcx > , f : & ' tcx hir:: Expr < ' tcx > ) -> ( Span , Symbol , SymbolStr ) {
304
+ fn panic_call < ' tcx > ( cx : & LateContext < ' tcx > , f : & ' tcx hir:: Expr < ' tcx > ) -> ( Span , Symbol , Symbol ) {
305
305
let mut expn = f. span . ctxt ( ) . outer_expn_data ( ) ;
306
306
307
307
let mut panic_macro = kw:: Empty ;
@@ -328,7 +328,7 @@ fn panic_call<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>) -> (Span,
328
328
329
329
let macro_symbol =
330
330
if let hygiene:: ExpnKind :: Macro ( _, symbol) = expn. kind { symbol } else { sym:: panic } ;
331
- ( expn. call_site , panic_macro, macro_symbol. as_str ( ) )
331
+ ( expn. call_site , panic_macro, macro_symbol)
332
332
}
333
333
334
334
fn is_arg_inside_call ( arg : Span , call : Span ) -> bool {
0 commit comments