@@ -18,6 +18,7 @@ use rustc_hir::{TraitItem, TraitItemKind};
1818use rustc_lint:: { LateContext , LateLintPass , Lint , LintContext } ;
1919use rustc_middle:: lint:: in_external_macro;
2020use rustc_middle:: ty:: { self , TraitRef , Ty , TyS } ;
21+ use rustc_semver:: RustcVersion ;
2122use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
2223use rustc_span:: source_map:: Span ;
2324use rustc_span:: symbol:: { sym, SymbolStr } ;
@@ -33,7 +34,6 @@ use crate::utils::{
3334 snippet_with_macro_callsite, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then, sugg,
3435 walk_ptrs_ty_depth, SpanlessEq ,
3536} ;
36- use semver:: { Version , VersionReq } ;
3737
3838declare_clippy_lint ! {
3939 /// **What it does:** Checks for `.unwrap()` calls on `Option`s and on `Result`s.
@@ -1405,12 +1405,12 @@ declare_clippy_lint! {
14051405}
14061406
14071407pub struct Methods {
1408- msrv : Option < VersionReq > ,
1408+ msrv : Option < RustcVersion > ,
14091409}
14101410
14111411impl Methods {
14121412 #[ must_use]
1413- pub fn new ( msrv : Option < VersionReq > ) -> Self {
1413+ pub fn new ( msrv : Option < RustcVersion > ) -> Self {
14141414 Self { msrv }
14151415 }
14161416}
@@ -3470,13 +3470,7 @@ fn lint_suspicious_map(cx: &LateContext<'_>, expr: &hir::Expr<'_>) {
34703470 ) ;
34713471}
34723472
3473- const OPTION_AS_REF_DEREF_MSRV : Version = Version {
3474- major : 1 ,
3475- minor : 40 ,
3476- patch : 0 ,
3477- pre : Vec :: new ( ) ,
3478- build : Vec :: new ( ) ,
3479- } ;
3473+ const OPTION_AS_REF_DEREF_MSRV : RustcVersion = RustcVersion :: new ( 1 , 40 , 0 ) ;
34803474
34813475/// lint use of `_.as_ref().map(Deref::deref)` for `Option`s
34823476fn lint_option_as_ref_deref < ' tcx > (
@@ -3485,7 +3479,7 @@ fn lint_option_as_ref_deref<'tcx>(
34853479 as_ref_args : & [ hir:: Expr < ' _ > ] ,
34863480 map_args : & [ hir:: Expr < ' _ > ] ,
34873481 is_mut : bool ,
3488- msrv : Option < & VersionReq > ,
3482+ msrv : Option < & RustcVersion > ,
34893483) {
34903484 if !meets_msrv ( msrv, & OPTION_AS_REF_DEREF_MSRV ) {
34913485 return ;
0 commit comments