@@ -9,7 +9,7 @@ use rustc_middle::ty::subst::InternalSubsts;
99use rustc_parse_format:: { ParseMode , Parser , Piece } ;
1010use rustc_session:: lint:: FutureIncompatibilityReason ;
1111use 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 } ;
1313use rustc_trait_selection:: infer:: InferCtxtExt ;
1414
1515declare_lint ! {
@@ -78,7 +78,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
7878
7979 // The argument is *not* a string literal.
8080
81- let ( span, panic, symbol_str ) = panic_call ( cx, f) ;
81+ let ( span, panic, symbol ) = panic_call ( cx, f) ;
8282
8383 if in_external_macro ( cx. sess ( ) , span) {
8484 // 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
103103
104104 cx. struct_span_lint ( NON_FMT_PANICS , arg_span, |lint| {
105105 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 ) ) ;
107107 l. note ( "for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>" ) ;
108108 if !is_arg_inside_call ( arg_span, span) {
109109 // 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
112112 }
113113 if arg_macro. map_or ( false , |id| cx. tcx . is_diagnostic_item ( sym:: format_macro, id) ) {
114114 // 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 ( ) ) ;
116116 if let Some ( ( open, close, _) ) = find_delimiters ( cx, arg_span) {
117117 l. multipart_suggestion (
118118 "remove the `format!(..)` macro call" ,
@@ -301,7 +301,7 @@ fn find_delimiters<'tcx>(cx: &LateContext<'tcx>, span: Span) -> Option<(Span, Sp
301301 ) )
302302}
303303
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 ) {
305305 let mut expn = f. span . ctxt ( ) . outer_expn_data ( ) ;
306306
307307 let mut panic_macro = kw:: Empty ;
@@ -328,7 +328,7 @@ fn panic_call<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>) -> (Span,
328328
329329 let macro_symbol =
330330 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)
332332}
333333
334334fn is_arg_inside_call ( arg : Span , call : Span ) -> bool {
0 commit comments