@@ -62,13 +62,11 @@ mod zst_offset;
62
62
use bind_instead_of_map:: BindInsteadOfMap ;
63
63
use clippy_utils:: diagnostics:: { span_lint, span_lint_and_help} ;
64
64
use clippy_utils:: ty:: { contains_ty, implements_trait, is_copy, is_type_diagnostic_item} ;
65
- use clippy_utils:: {
66
- contains_return, get_trait_def_id, in_macro, iter_input_pats, match_qpath, method_calls, paths, return_ty,
67
- SpanlessEq ,
68
- } ;
65
+ use clippy_utils:: { contains_return, get_trait_def_id, in_macro, iter_input_pats, method_calls, paths, return_ty} ;
69
66
use if_chain:: if_chain;
70
67
use rustc_hir as hir;
71
- use rustc_hir:: { TraitItem , TraitItemKind } ;
68
+ use rustc_hir:: def:: Res ;
69
+ use rustc_hir:: { PrimTy , QPath , TraitItem , TraitItemKind } ;
72
70
use rustc_lint:: { LateContext , LateLintPass , LintContext } ;
73
71
use rustc_middle:: lint:: in_external_macro;
74
72
use rustc_middle:: ty:: { self , TraitRef , Ty , TyS } ;
@@ -1872,7 +1870,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
1872
1870
for method_config in & TRAIT_METHODS {
1873
1871
if name == method_config. method_name &&
1874
1872
sig. decl. inputs. len( ) == method_config. param_count &&
1875
- method_config. output_type. matches( cx , & sig. decl. output) &&
1873
+ method_config. output_type. matches( & sig. decl. output) &&
1876
1874
method_config. self_kind. matches( cx, self_ty, first_arg_ty) &&
1877
1875
fn_header_equals( method_config. fn_header, sig. header) &&
1878
1876
method_config. lifetime_param_cond( & impl_item)
@@ -2199,8 +2197,8 @@ enum OutType {
2199
2197
}
2200
2198
2201
2199
impl OutType {
2202
- fn matches ( self , cx : & LateContext < ' _ > , ty : & hir:: FnRetTy < ' _ > ) -> bool {
2203
- let is_unit = |ty : & hir:: Ty < ' _ > | SpanlessEq :: new ( cx ) . eq_ty_kind ( & ty. kind , & hir:: TyKind :: Tup ( & [ ] ) ) ;
2200
+ fn matches ( self , ty : & hir:: FnRetTy < ' _ > ) -> bool {
2201
+ let is_unit = |ty : & hir:: Ty < ' _ > | matches ! ( ty. kind, hir:: TyKind :: Tup ( & [ ] ) ) ;
2204
2202
match ( self , ty) {
2205
2203
( Self :: Unit , & hir:: FnRetTy :: DefaultReturn ( _) ) => true ,
2206
2204
( Self :: Unit , & hir:: FnRetTy :: Return ( ref ty) ) if is_unit ( ty) => true ,
@@ -2213,8 +2211,8 @@ impl OutType {
2213
2211
}
2214
2212
2215
2213
fn is_bool ( ty : & hir:: Ty < ' _ > ) -> bool {
2216
- if let hir:: TyKind :: Path ( ref p ) = ty. kind {
2217
- match_qpath ( p , & [ "bool" ] )
2214
+ if let hir:: TyKind :: Path ( QPath :: Resolved ( _ , path ) ) = ty. kind {
2215
+ matches ! ( path . res , Res :: PrimTy ( PrimTy :: Bool ) )
2218
2216
} else {
2219
2217
false
2220
2218
}
0 commit comments