Skip to content

Commit f7a73f1

Browse files
committed
should_implement_trait - pr remarks
1 parent 93812c1 commit f7a73f1

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
@@ -1499,10 +1499,10 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
14991499
// check missing trait implementations
15001500
for &(method_name, n_args, fn_header, self_kind, out_type, trait_name) in &TRAIT_METHODS {
15011501
let no_lifetime_params = || {
1502-
impl_item.generics.params.iter().filter(|p| match p.kind {
1503-
hir::GenericParamKind::Lifetime { .. } => true,
1504-
_ => false,
1505-
}).count() == 0
1502+
!impl_item.generics.params.iter()
1503+
.any(|p| matches!(
1504+
p.kind,
1505+
hir::GenericParamKind::Lifetime { .. }))
15061506
};
15071507
if name == method_name &&
15081508
sig.decl.inputs.len() == n_args &&
@@ -1511,7 +1511,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
15111511
fn_header_equals(*fn_header, sig.header) &&
15121512
// ignore methods with lifetime params, risk of false positive
15131513
no_lifetime_params()
1514-
{
1514+
{
15151515
span_lint(cx, SHOULD_IMPLEMENT_TRAIT, impl_item.span, &format!(
15161516
"defining a method called `{}` on this type; consider implementing \
15171517
the `{}` trait or choosing a less ambiguous name", name, trait_name));

0 commit comments

Comments
 (0)