@@ -17,7 +17,7 @@ use rustc_semver::RustcVersion;
17
17
use rustc_session:: { declare_lint_pass, declare_tool_lint, impl_lint_pass} ;
18
18
use rustc_span:: source_map:: Span ;
19
19
use rustc_span:: sym;
20
- use rustc_span:: symbol:: { Symbol , SymbolStr } ;
20
+ use rustc_span:: symbol:: Symbol ;
21
21
use semver:: Version ;
22
22
23
23
static UNIX_SYSTEMS : & [ & str ] = & [
@@ -310,8 +310,10 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
310
310
|| is_word ( lint, sym:: deprecated)
311
311
|| is_word ( lint, sym ! ( unreachable_pub) )
312
312
|| 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" )
315
317
{
316
318
return ;
317
319
}
@@ -370,15 +372,15 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
370
372
}
371
373
372
374
/// 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 > {
374
376
if_chain ! {
375
377
if let Some ( meta_item) = lint. meta_item( ) ;
376
378
if meta_item. path. segments. len( ) > 1 ;
377
379
if let tool_name = meta_item. path. segments[ 0 ] . ident;
378
380
if tool_name. name == sym:: clippy;
379
381
then {
380
382
let lint_name = meta_item. path. segments. last( ) . unwrap( ) . ident. name;
381
- return Some ( lint_name. as_str ( ) ) ;
383
+ return Some ( lint_name) ;
382
384
}
383
385
}
384
386
None
@@ -387,7 +389,7 @@ fn extract_clippy_lint(lint: &NestedMetaItem) -> Option<SymbolStr> {
387
389
fn check_clippy_lint_names ( cx : & LateContext < ' _ > , name : Symbol , items : & [ NestedMetaItem ] ) {
388
390
for lint in items {
389
391
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 {
391
393
span_lint_and_help (
392
394
cx,
393
395
BLANKET_CLIPPY_RESTRICTION_LINTS ,
@@ -486,7 +488,7 @@ fn check_attrs(cx: &LateContext<'_>, span: Span, name: Symbol, attrs: &[Attribut
486
488
487
489
fn check_semver ( cx : & LateContext < ' _ > , span : Span , lit : & Lit ) {
488
490
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 ( ) {
490
492
return ;
491
493
}
492
494
}
@@ -619,7 +621,7 @@ fn check_mismatched_target_os(cx: &EarlyContext<'_>, attr: &Attribute) {
619
621
MetaItemKind :: Word => {
620
622
if_chain ! {
621
623
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( ) ) ;
623
625
then {
624
626
mismatched. push( ( os, ident. span) ) ;
625
627
}
0 commit comments