@@ -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,8 @@ 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) . map_or ( false , |s| s. as_str ( ) == "wildcard_imports" )
314
+ || extract_clippy_lint ( lint) . map_or ( false , |s| s. as_str ( ) == "enum_glob_use" )
315
315
{
316
316
return ;
317
317
}
@@ -370,15 +370,15 @@ impl<'tcx> LateLintPass<'tcx> for Attributes {
370
370
}
371
371
372
372
/// Returns the lint name if it is clippy lint.
373
- fn extract_clippy_lint ( lint : & NestedMetaItem ) -> Option < SymbolStr > {
373
+ fn extract_clippy_lint ( lint : & NestedMetaItem ) -> Option < Symbol > {
374
374
if_chain ! {
375
375
if let Some ( meta_item) = lint. meta_item( ) ;
376
376
if meta_item. path. segments. len( ) > 1 ;
377
377
if let tool_name = meta_item. path. segments[ 0 ] . ident;
378
378
if tool_name. name == sym:: clippy;
379
379
then {
380
380
let lint_name = meta_item. path. segments. last( ) . unwrap( ) . ident. name;
381
- return Some ( lint_name. as_str ( ) ) ;
381
+ return Some ( lint_name) ;
382
382
}
383
383
}
384
384
None
@@ -387,7 +387,7 @@ fn extract_clippy_lint(lint: &NestedMetaItem) -> Option<SymbolStr> {
387
387
fn check_clippy_lint_names ( cx : & LateContext < ' _ > , name : Symbol , items : & [ NestedMetaItem ] ) {
388
388
for lint in items {
389
389
if let Some ( lint_name) = extract_clippy_lint ( lint) {
390
- if lint_name == "restriction" && name != sym:: allow {
390
+ if lint_name. as_str ( ) == "restriction" && name != sym:: allow {
391
391
span_lint_and_help (
392
392
cx,
393
393
BLANKET_CLIPPY_RESTRICTION_LINTS ,
@@ -486,7 +486,7 @@ fn check_attrs(cx: &LateContext<'_>, span: Span, name: Symbol, attrs: &[Attribut
486
486
487
487
fn check_semver ( cx : & LateContext < ' _ > , span : Span , lit : & Lit ) {
488
488
if let LitKind :: Str ( is, _) = lit. kind {
489
- if Version :: parse ( & is. as_str ( ) ) . is_ok ( ) {
489
+ if Version :: parse ( is. as_str ( ) ) . is_ok ( ) {
490
490
return ;
491
491
}
492
492
}
@@ -619,7 +619,7 @@ fn check_mismatched_target_os(cx: &EarlyContext<'_>, attr: &Attribute) {
619
619
MetaItemKind :: Word => {
620
620
if_chain ! {
621
621
if let Some ( ident) = meta. ident( ) ;
622
- if let Some ( os) = find_os( & * ident. name. as_str( ) ) ;
622
+ if let Some ( os) = find_os( ident. name. as_str( ) ) ;
623
623
then {
624
624
mismatched. push( ( os, ident. span) ) ;
625
625
}
0 commit comments