@@ -18,6 +18,7 @@ use rustc_hir::{TraitItem, TraitItemKind};
18
18
use rustc_lint:: { LateContext , LateLintPass , Lint , LintContext } ;
19
19
use rustc_middle:: lint:: in_external_macro;
20
20
use rustc_middle:: ty:: { self , TraitRef , Ty , TyS } ;
21
+ use rustc_semver:: RustcVersion ;
21
22
use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
22
23
use rustc_span:: source_map:: Span ;
23
24
use rustc_span:: symbol:: { sym, SymbolStr } ;
@@ -33,7 +34,6 @@ use crate::utils::{
33
34
snippet_with_macro_callsite, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then, sugg,
34
35
walk_ptrs_ty_depth, SpanlessEq ,
35
36
} ;
36
- use semver:: { Version , VersionReq } ;
37
37
38
38
declare_clippy_lint ! {
39
39
/// **What it does:** Checks for `.unwrap()` calls on `Option`s and on `Result`s.
@@ -1405,12 +1405,12 @@ declare_clippy_lint! {
1405
1405
}
1406
1406
1407
1407
pub struct Methods {
1408
- msrv : Option < VersionReq > ,
1408
+ msrv : Option < RustcVersion > ,
1409
1409
}
1410
1410
1411
1411
impl Methods {
1412
1412
#[ must_use]
1413
- pub fn new ( msrv : Option < VersionReq > ) -> Self {
1413
+ pub fn new ( msrv : Option < RustcVersion > ) -> Self {
1414
1414
Self { msrv }
1415
1415
}
1416
1416
}
@@ -3470,13 +3470,7 @@ fn lint_suspicious_map(cx: &LateContext<'_>, expr: &hir::Expr<'_>) {
3470
3470
) ;
3471
3471
}
3472
3472
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 ) ;
3480
3474
3481
3475
/// lint use of `_.as_ref().map(Deref::deref)` for `Option`s
3482
3476
fn lint_option_as_ref_deref < ' tcx > (
@@ -3485,7 +3479,7 @@ fn lint_option_as_ref_deref<'tcx>(
3485
3479
as_ref_args : & [ hir:: Expr < ' _ > ] ,
3486
3480
map_args : & [ hir:: Expr < ' _ > ] ,
3487
3481
is_mut : bool ,
3488
- msrv : Option < & VersionReq > ,
3482
+ msrv : Option < & RustcVersion > ,
3489
3483
) {
3490
3484
if !meets_msrv ( msrv, & OPTION_AS_REF_DEREF_MSRV ) {
3491
3485
return ;
0 commit comments