@@ -213,17 +213,17 @@ impl<'a, 'tcx: 'a> Visitor<'tcx> for LintCollector<'a, 'tcx> {
213
213
214
214
#[ derive( Clone , Default ) ]
215
215
pub struct CompilerLintFunctions {
216
- map : FxHashMap < String , String > ,
216
+ map : FxHashMap < & ' static str , & ' static str > ,
217
217
}
218
218
219
219
impl CompilerLintFunctions {
220
220
pub fn new ( ) -> Self {
221
221
let mut map = FxHashMap :: default ( ) ;
222
- map. insert ( "span_lint" . to_string ( ) , "utils::span_lint" . to_string ( ) ) ;
223
- map. insert ( "struct_span_lint" . to_string ( ) , "utils::span_lint" . to_string ( ) ) ;
224
- map. insert ( "lint" . to_string ( ) , "utils::span_lint" . to_string ( ) ) ;
225
- map. insert ( "span_lint_note" . to_string ( ) , "utils::span_note_and_lint" . to_string ( ) ) ;
226
- map. insert ( "span_lint_help" . to_string ( ) , "utils::span_help_and_lint" . to_string ( ) ) ;
222
+ map. insert ( "span_lint" , "utils::span_lint" ) ;
223
+ map. insert ( "struct_span_lint" , "utils::span_lint" ) ;
224
+ map. insert ( "lint" , "utils::span_lint" ) ;
225
+ map. insert ( "span_lint_note" , "utils::span_note_and_lint" ) ;
226
+ map. insert ( "span_lint_help" , "utils::span_help_and_lint" ) ;
227
227
Self { map }
228
228
}
229
229
}
@@ -234,8 +234,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CompilerLintFunctions {
234
234
fn check_expr ( & mut self , cx : & LateContext < ' a , ' tcx > , expr : & ' tcx Expr ) {
235
235
if_chain ! {
236
236
if let ExprKind :: MethodCall ( ref path, _, ref args) = expr. node;
237
- let fn_name = path. ident. as_str ( ) . to_string ( ) ;
238
- if let Some ( sugg) = self . map. get( & fn_name) ;
237
+ let fn_name = path. ident;
238
+ if let Some ( sugg) = self . map. get( & * fn_name. as_str ( ) ) ;
239
239
let ty = walk_ptrs_ty( cx. tables. expr_ty( & args[ 0 ] ) ) ;
240
240
if match_type( cx, ty, & paths:: EARLY_CONTEXT )
241
241
|| match_type( cx, ty, & paths:: LATE_CONTEXT ) ;
0 commit comments