Skip to content

Commit e6b2254

Browse files
committed
should_implement_trait - pr remarks
1 parent 2bc0ecd commit e6b2254

File tree

1 file changed

+5
-5
lines changed
  • clippy_lints/src/methods

1 file changed

+5
-5
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,10 +1498,10 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
14981498
// check missing trait implementations
14991499
for &(method_name, n_args, fn_header, self_kind, out_type, trait_name) in &TRAIT_METHODS {
15001500
let no_lifetime_params = || {
1501-
impl_item.generics.params.iter().filter(|p| match p.kind {
1502-
hir::GenericParamKind::Lifetime { .. } => true,
1503-
_ => false,
1504-
}).count() == 0
1501+
!impl_item.generics.params.iter()
1502+
.any(|p| matches!(
1503+
p.kind,
1504+
hir::GenericParamKind::Lifetime { .. }))
15051505
};
15061506
if name == method_name &&
15071507
sig.decl.inputs.len() == n_args &&
@@ -1510,7 +1510,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
15101510
fn_header_equals(*fn_header, sig.header) &&
15111511
// ignore methods with lifetime params, risk of false positive
15121512
no_lifetime_params()
1513-
{
1513+
{
15141514
span_lint(cx, SHOULD_IMPLEMENT_TRAIT, impl_item.span, &format!(
15151515
"defining a method called `{}` on this type; consider implementing \
15161516
the `{}` trait or choosing a less ambiguous name", name, trait_name));

0 commit comments

Comments
 (0)