@@ -1470,6 +1470,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
1470
1470
}
1471
1471
}
1472
1472
1473
+ #[ allow( clippy:: too_many_lines) ]
1473
1474
fn check_impl_item ( & mut self , cx : & LateContext < ' tcx > , impl_item : & ' tcx hir:: ImplItem < ' _ > ) {
1474
1475
if in_external_macro ( cx. sess ( ) , impl_item. span ) {
1475
1476
return ;
@@ -1501,7 +1502,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
1501
1502
sig. decl. inputs. len( ) == method_config. param_count &&
1502
1503
method_config. output_type. matches( cx, & sig. decl. output) &&
1503
1504
method_config. self_kind. matches( cx, self_ty, first_arg_ty) &&
1504
- fn_header_equals( * method_config. fn_header, sig. header) &&
1505
+ fn_header_equals( method_config. fn_header, sig. header) &&
1505
1506
method_config. lifetime_param_cond( & impl_item)
1506
1507
{
1507
1508
span_lint_and_help(
@@ -3422,7 +3423,7 @@ struct ShouldImplTraitCase {
3422
3423
trait_name : & ' static str ,
3423
3424
method_name : & ' static str ,
3424
3425
param_count : usize ,
3425
- fn_header : & ' static hir:: FnHeader ,
3426
+ fn_header : hir:: FnHeader ,
3426
3427
// implicit self kind expected (none, self, &self, ...)
3427
3428
self_kind : SelfKind ,
3428
3429
// checks against the output type
@@ -3435,7 +3436,7 @@ impl ShouldImplTraitCase {
3435
3436
trait_name : & ' static str ,
3436
3437
method_name : & ' static str ,
3437
3438
param_count : usize ,
3438
- fn_header : & ' static hir:: FnHeader ,
3439
+ fn_header : hir:: FnHeader ,
3439
3440
self_kind : SelfKind ,
3440
3441
output_type : OutType ,
3441
3442
lint_explicit_lifetime : bool ,
@@ -3466,37 +3467,37 @@ impl ShouldImplTraitCase {
3466
3467
3467
3468
#[ rustfmt:: skip]
3468
3469
const TRAIT_METHODS : [ ShouldImplTraitCase ; 30 ] = [
3469
- ShouldImplTraitCase :: new ( "std::ops::Add" , "add" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3470
- ShouldImplTraitCase :: new ( "std::convert::AsMut" , "as_mut" , 1 , & FN_HEADER , SelfKind :: RefMut , OutType :: Ref , true ) ,
3471
- ShouldImplTraitCase :: new ( "std::convert::AsRef" , "as_ref" , 1 , & FN_HEADER , SelfKind :: Ref , OutType :: Ref , true ) ,
3472
- ShouldImplTraitCase :: new ( "std::ops::BitAnd" , "bitand" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3473
- ShouldImplTraitCase :: new ( "std::ops::BitOr" , "bitor" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3474
- ShouldImplTraitCase :: new ( "std::ops::BitXor" , "bitxor" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3475
- ShouldImplTraitCase :: new ( "std::borrow::Borrow" , "borrow" , 1 , & FN_HEADER , SelfKind :: Ref , OutType :: Ref , true ) ,
3476
- ShouldImplTraitCase :: new ( "std::borrow::BorrowMut" , "borrow_mut" , 1 , & FN_HEADER , SelfKind :: RefMut , OutType :: Ref , true ) ,
3477
- ShouldImplTraitCase :: new ( "std::clone::Clone" , "clone" , 1 , & FN_HEADER , SelfKind :: Ref , OutType :: Any , true ) ,
3478
- ShouldImplTraitCase :: new ( "std::cmp::Ord" , "cmp" , 2 , & FN_HEADER , SelfKind :: Ref , OutType :: Any , true ) ,
3470
+ ShouldImplTraitCase :: new ( "std::ops::Add" , "add" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3471
+ ShouldImplTraitCase :: new ( "std::convert::AsMut" , "as_mut" , 1 , FN_HEADER , SelfKind :: RefMut , OutType :: Ref , true ) ,
3472
+ ShouldImplTraitCase :: new ( "std::convert::AsRef" , "as_ref" , 1 , FN_HEADER , SelfKind :: Ref , OutType :: Ref , true ) ,
3473
+ ShouldImplTraitCase :: new ( "std::ops::BitAnd" , "bitand" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3474
+ ShouldImplTraitCase :: new ( "std::ops::BitOr" , "bitor" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3475
+ ShouldImplTraitCase :: new ( "std::ops::BitXor" , "bitxor" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3476
+ ShouldImplTraitCase :: new ( "std::borrow::Borrow" , "borrow" , 1 , FN_HEADER , SelfKind :: Ref , OutType :: Ref , true ) ,
3477
+ ShouldImplTraitCase :: new ( "std::borrow::BorrowMut" , "borrow_mut" , 1 , FN_HEADER , SelfKind :: RefMut , OutType :: Ref , true ) ,
3478
+ ShouldImplTraitCase :: new ( "std::clone::Clone" , "clone" , 1 , FN_HEADER , SelfKind :: Ref , OutType :: Any , true ) ,
3479
+ ShouldImplTraitCase :: new ( "std::cmp::Ord" , "cmp" , 2 , FN_HEADER , SelfKind :: Ref , OutType :: Any , true ) ,
3479
3480
// FIXME: default doesn't work
3480
- ShouldImplTraitCase :: new ( "std::default::Default" , "default" , 0 , & FN_HEADER , SelfKind :: No , OutType :: Any , true ) ,
3481
- ShouldImplTraitCase :: new ( "std::ops::Deref" , "deref" , 1 , & FN_HEADER , SelfKind :: Ref , OutType :: Ref , true ) ,
3482
- ShouldImplTraitCase :: new ( "std::ops::DerefMut" , "deref_mut" , 1 , & FN_HEADER , SelfKind :: RefMut , OutType :: Ref , true ) ,
3483
- ShouldImplTraitCase :: new ( "std::ops::Div" , "div" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3484
- ShouldImplTraitCase :: new ( "std::ops::Drop" , "drop" , 1 , & FN_HEADER , SelfKind :: RefMut , OutType :: Unit , true ) ,
3485
- ShouldImplTraitCase :: new ( "std::cmp::PartialEq" , "eq" , 2 , & FN_HEADER , SelfKind :: Ref , OutType :: Bool , true ) ,
3486
- ShouldImplTraitCase :: new ( "std::iter::FromIterator" , "from_iter" , 1 , & FN_HEADER , SelfKind :: No , OutType :: Any , true ) ,
3487
- ShouldImplTraitCase :: new ( "std::str::FromStr" , "from_str" , 1 , & FN_HEADER , SelfKind :: No , OutType :: Any , true ) ,
3488
- ShouldImplTraitCase :: new ( "std::hash::Hash" , "hash" , 2 , & FN_HEADER , SelfKind :: Ref , OutType :: Unit , true ) ,
3489
- ShouldImplTraitCase :: new ( "std::ops::Index" , "index" , 2 , & FN_HEADER , SelfKind :: Ref , OutType :: Ref , true ) ,
3490
- ShouldImplTraitCase :: new ( "std::ops::IndexMut" , "index_mut" , 2 , & FN_HEADER , SelfKind :: RefMut , OutType :: Ref , true ) ,
3491
- ShouldImplTraitCase :: new ( "std::iter::IntoIterator" , "into_iter" , 1 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3492
- ShouldImplTraitCase :: new ( "std::ops::Mul" , "mul" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3493
- ShouldImplTraitCase :: new ( "std::ops::Neg" , "neg" , 1 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3494
- ShouldImplTraitCase :: new ( "std::iter::Iterator" , "next" , 1 , & FN_HEADER , SelfKind :: RefMut , OutType :: Any , false ) ,
3495
- ShouldImplTraitCase :: new ( "std::ops::Not" , "not" , 1 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3496
- ShouldImplTraitCase :: new ( "std::ops::Rem" , "rem" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3497
- ShouldImplTraitCase :: new ( "std::ops::Shl" , "shl" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3498
- ShouldImplTraitCase :: new ( "std::ops::Shr" , "shr" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3499
- ShouldImplTraitCase :: new ( "std::ops::Sub" , "sub" , 2 , & FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3481
+ ShouldImplTraitCase :: new ( "std::default::Default" , "default" , 0 , FN_HEADER , SelfKind :: No , OutType :: Any , true ) ,
3482
+ ShouldImplTraitCase :: new ( "std::ops::Deref" , "deref" , 1 , FN_HEADER , SelfKind :: Ref , OutType :: Ref , true ) ,
3483
+ ShouldImplTraitCase :: new ( "std::ops::DerefMut" , "deref_mut" , 1 , FN_HEADER , SelfKind :: RefMut , OutType :: Ref , true ) ,
3484
+ ShouldImplTraitCase :: new ( "std::ops::Div" , "div" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3485
+ ShouldImplTraitCase :: new ( "std::ops::Drop" , "drop" , 1 , FN_HEADER , SelfKind :: RefMut , OutType :: Unit , true ) ,
3486
+ ShouldImplTraitCase :: new ( "std::cmp::PartialEq" , "eq" , 2 , FN_HEADER , SelfKind :: Ref , OutType :: Bool , true ) ,
3487
+ ShouldImplTraitCase :: new ( "std::iter::FromIterator" , "from_iter" , 1 , FN_HEADER , SelfKind :: No , OutType :: Any , true ) ,
3488
+ ShouldImplTraitCase :: new ( "std::str::FromStr" , "from_str" , 1 , FN_HEADER , SelfKind :: No , OutType :: Any , true ) ,
3489
+ ShouldImplTraitCase :: new ( "std::hash::Hash" , "hash" , 2 , FN_HEADER , SelfKind :: Ref , OutType :: Unit , true ) ,
3490
+ ShouldImplTraitCase :: new ( "std::ops::Index" , "index" , 2 , FN_HEADER , SelfKind :: Ref , OutType :: Ref , true ) ,
3491
+ ShouldImplTraitCase :: new ( "std::ops::IndexMut" , "index_mut" , 2 , FN_HEADER , SelfKind :: RefMut , OutType :: Ref , true ) ,
3492
+ ShouldImplTraitCase :: new ( "std::iter::IntoIterator" , "into_iter" , 1 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3493
+ ShouldImplTraitCase :: new ( "std::ops::Mul" , "mul" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3494
+ ShouldImplTraitCase :: new ( "std::ops::Neg" , "neg" , 1 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3495
+ ShouldImplTraitCase :: new ( "std::iter::Iterator" , "next" , 1 , FN_HEADER , SelfKind :: RefMut , OutType :: Any , false ) ,
3496
+ ShouldImplTraitCase :: new ( "std::ops::Not" , "not" , 1 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3497
+ ShouldImplTraitCase :: new ( "std::ops::Rem" , "rem" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3498
+ ShouldImplTraitCase :: new ( "std::ops::Shl" , "shl" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3499
+ ShouldImplTraitCase :: new ( "std::ops::Shr" , "shr" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3500
+ ShouldImplTraitCase :: new ( "std::ops::Sub" , "sub" , 2 , FN_HEADER , SelfKind :: Value , OutType :: Any , true ) ,
3500
3501
] ;
3501
3502
3502
3503
#[ rustfmt:: skip]
0 commit comments