22
33use clippy_utils:: diagnostics:: { span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then} ;
44use clippy_utils:: macros:: { is_panic, macro_backtrace} ;
5- use clippy_utils:: msrvs;
5+ use clippy_utils:: msrvs:: { self , Msrv } ;
66use clippy_utils:: source:: { first_line_of_span, is_present_in_source, snippet_opt, without_block_comments} ;
7- use clippy_utils:: { extract_msrv_attr, meets_msrv} ;
87use if_chain:: if_chain;
98use rustc_ast:: { AttrKind , AttrStyle , Attribute , Lit , LitKind , MetaItemKind , NestedMetaItem } ;
109use rustc_errors:: Applicability ;
@@ -14,7 +13,6 @@ use rustc_hir::{
1413use rustc_lint:: { EarlyContext , EarlyLintPass , LateContext , LateLintPass , Level , LintContext } ;
1514use rustc_middle:: lint:: in_external_macro;
1615use rustc_middle:: ty;
17- use rustc_semver:: RustcVersion ;
1816use rustc_session:: { declare_lint_pass, declare_tool_lint, impl_lint_pass} ;
1917use rustc_span:: source_map:: Span ;
2018use rustc_span:: symbol:: Symbol ;
@@ -599,7 +597,7 @@ fn is_word(nmi: &NestedMetaItem, expected: Symbol) -> bool {
599597}
600598
601599pub struct EarlyAttributes {
602- pub msrv : Option < RustcVersion > ,
600+ pub msrv : Msrv ,
603601}
604602
605603impl_lint_pass ! ( EarlyAttributes => [
@@ -614,7 +612,7 @@ impl EarlyLintPass for EarlyAttributes {
614612 }
615613
616614 fn check_attribute ( & mut self , cx : & EarlyContext < ' _ > , attr : & Attribute ) {
617- check_deprecated_cfg_attr ( cx, attr, self . msrv ) ;
615+ check_deprecated_cfg_attr ( cx, attr, & self . msrv ) ;
618616 check_mismatched_target_os ( cx, attr) ;
619617 }
620618
@@ -654,9 +652,9 @@ fn check_empty_line_after_outer_attr(cx: &EarlyContext<'_>, item: &rustc_ast::It
654652 }
655653}
656654
657- fn check_deprecated_cfg_attr ( cx : & EarlyContext < ' _ > , attr : & Attribute , msrv : Option < RustcVersion > ) {
655+ fn check_deprecated_cfg_attr ( cx : & EarlyContext < ' _ > , attr : & Attribute , msrv : & Msrv ) {
658656 if_chain ! {
659- if meets_msrv ( msrv, msrvs:: TOOL_ATTRIBUTES ) ;
657+ if msrv. meets ( msrvs:: TOOL_ATTRIBUTES ) ;
660658 // check cfg_attr
661659 if attr. has_name( sym:: cfg_attr) ;
662660 if let Some ( items) = attr. meta_item_list( ) ;
0 commit comments