@@ -17,7 +17,7 @@ use rustc_semver::RustcVersion;
1717use rustc_session:: { declare_lint_pass, declare_tool_lint, impl_lint_pass} ;
1818use rustc_span:: source_map:: Span ;
1919use rustc_span:: sym;
20- use rustc_span:: symbol:: { Symbol , SymbolStr } ;
20+ use rustc_span:: symbol:: Symbol ;
2121use semver:: Version ;
2222
2323static UNIX_SYSTEMS : & [ & str ] = & [
@@ -310,8 +310,10 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
310310 || is_word ( lint, sym:: deprecated)
311311 || is_word ( lint, sym ! ( unreachable_pub) )
312312 || is_word ( lint, sym ! ( unused) )
313- || extract_clippy_lint ( lint) . map_or ( false , |s| s == "wildcard_imports" )
314- || extract_clippy_lint ( lint) . map_or ( false , |s| s == "enum_glob_use" )
313+ || extract_clippy_lint ( lint)
314+ . map_or ( false , |s| s. as_str ( ) == "wildcard_imports" )
315+ || extract_clippy_lint ( lint)
316+ . map_or ( false , |s| s. as_str ( ) == "enum_glob_use" )
315317 {
316318 return ;
317319 }
@@ -370,15 +372,15 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
370372}
371373
372374/// Returns the lint name if it is clippy lint.
373- fn extract_clippy_lint ( lint : & NestedMetaItem ) -> Option < SymbolStr > {
375+ fn extract_clippy_lint ( lint : & NestedMetaItem ) -> Option < Symbol > {
374376 if_chain ! {
375377 if let Some ( meta_item) = lint. meta_item( ) ;
376378 if meta_item. path. segments. len( ) > 1 ;
377379 if let tool_name = meta_item. path. segments[ 0 ] . ident;
378380 if tool_name. name == sym:: clippy;
379381 then {
380382 let lint_name = meta_item. path. segments. last( ) . unwrap( ) . ident. name;
381- return Some ( lint_name. as_str ( ) ) ;
383+ return Some ( lint_name) ;
382384 }
383385 }
384386 None
@@ -387,7 +389,7 @@ fn extract_clippy_lint(lint: &NestedMetaItem) -> Option<SymbolStr> {
387389fn check_clippy_lint_names ( cx : & LateContext < ' _ > , name : Symbol , items : & [ NestedMetaItem ] ) {
388390 for lint in items {
389391 if let Some ( lint_name) = extract_clippy_lint ( lint) {
390- if lint_name == "restriction" && name != sym:: allow {
392+ if lint_name. as_str ( ) == "restriction" && name != sym:: allow {
391393 span_lint_and_help (
392394 cx,
393395 BLANKET_CLIPPY_RESTRICTION_LINTS ,
@@ -486,7 +488,7 @@ fn check_attrs(cx: &LateContext<'_>, span: Span, name: Symbol, attrs: &[Attribut
486488
487489fn check_semver ( cx : & LateContext < ' _ > , span : Span , lit : & Lit ) {
488490 if let LitKind :: Str ( is, _) = lit. kind {
489- if Version :: parse ( & is. as_str ( ) ) . is_ok ( ) {
491+ if Version :: parse ( is. as_str ( ) ) . is_ok ( ) {
490492 return ;
491493 }
492494 }
@@ -619,7 +621,7 @@ fn check_mismatched_target_os(cx: &EarlyContext<'_>, attr: &Attribute) {
619621 MetaItemKind :: Word => {
620622 if_chain ! {
621623 if let Some ( ident) = meta. ident( ) ;
622- if let Some ( os) = find_os( & * ident. name. as_str( ) ) ;
624+ if let Some ( os) = find_os( ident. name. as_str( ) ) ;
623625 then {
624626 mismatched. push( ( os, ident. span) ) ;
625627 }
0 commit comments