@@ -4,7 +4,7 @@ use clippy_utils::msrvs::Msrv;
44use clippy_utils:: { is_in_const_context, is_in_test} ;
55use rustc_data_structures:: fx:: FxHashMap ;
66use rustc_hir:: def:: DefKind ;
7- use rustc_hir:: { self as hir, AmbigArg , Expr , ExprKind , HirId , QPath , RustcVersion , StabilityLevel , StableSince } ;
7+ use rustc_hir:: { self as hir, AmbigArg , Expr , ExprKind , HirId , RustcVersion , StabilityLevel , StableSince } ;
88use rustc_lint:: { LateContext , LateLintPass } ;
99use rustc_middle:: ty:: TyCtxt ;
1010use rustc_session:: impl_lint_pass;
@@ -193,10 +193,7 @@ impl<'tcx> LateLintPass<'tcx> for IncompatibleMsrv {
193193 self . emit_lint_if_under_msrv ( cx, method_did, expr. hir_id , span) ;
194194 }
195195 } ,
196- // Desugaring into function calls by the compiler will use `QPath::LangItem` variants. Those should
197- // not be linted as they will not be generated in older compilers if the function is not available,
198- // and the compiler is allowed to call unstable functions.
199- ExprKind :: Path ( qpath @ ( QPath :: Resolved ( ..) | QPath :: TypeRelative ( ..) ) ) => {
196+ ExprKind :: Path ( qpath) => {
200197 if let Some ( path_def_id) = cx. qpath_res ( & qpath, expr. hir_id ) . opt_def_id ( ) {
201198 self . emit_lint_if_under_msrv ( cx, path_def_id, expr. hir_id , expr. span ) ;
202199 }
@@ -206,7 +203,7 @@ impl<'tcx> LateLintPass<'tcx> for IncompatibleMsrv {
206203 }
207204
208205 fn check_ty ( & mut self , cx : & LateContext < ' tcx > , hir_ty : & ' tcx hir:: Ty < ' tcx , AmbigArg > ) {
209- if let hir:: TyKind :: Path ( qpath @ ( QPath :: Resolved ( .. ) | QPath :: TypeRelative ( .. ) ) ) = hir_ty. kind
206+ if let hir:: TyKind :: Path ( qpath) = hir_ty. kind
210207 && let Some ( ty_def_id) = cx. qpath_res ( & qpath, hir_ty. hir_id ) . opt_def_id ( )
211208 // `CStr` and `CString` have been moved around but have been available since Rust 1.0.0
212209 && !matches ! ( cx. tcx. get_diagnostic_name( ty_def_id) , Some ( sym:: cstr_type | sym:: cstring_type) )
0 commit comments