about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Nielens <tim.nielens@gmail.com>2020-06-21 00:12:09 +0200
committerTim Nielens <tim.nielens@gmail.com>2020-08-09 15:10:00 +0200
commite6b2254f9e55743dbace44cc73c6447b6bda58e5 (patch)
treea4f24e4b7d24f82ed7ca9b19183b3eb4d385d30e
parent2bc0ecd44b4d09476eade641e02451d949a1c8e2 (diff)
downloadrust-e6b2254f9e55743dbace44cc73c6447b6bda58e5.tar.gz
rust-e6b2254f9e55743dbace44cc73c6447b6bda58e5.zip
should_implement_trait - pr remarks
-rw-r--r--clippy_lints/src/methods/mod.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs
index c225a3bd359..a75989e3f13 100644
--- a/clippy_lints/src/methods/mod.rs
+++ b/clippy_lints/src/methods/mod.rs
@@ -1498,10 +1498,10 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
                 // check missing trait implementations
                     for &(method_name, n_args, fn_header, self_kind, out_type, trait_name) in &TRAIT_METHODS {
                         let no_lifetime_params = || {
-                            impl_item.generics.params.iter().filter(|p| match p.kind {
-                               hir::GenericParamKind::Lifetime { .. } => true,
-                               _ => false,
-                            }).count() == 0
+                            !impl_item.generics.params.iter()
+                                .any(|p| matches!(
+                                    p.kind,
+                                    hir::GenericParamKind::Lifetime { .. }))
                         };
                         if name == method_name &&
                             sig.decl.inputs.len() == n_args &&
@@ -1510,7 +1510,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
                             fn_header_equals(*fn_header, sig.header) &&
                             // ignore methods with lifetime params, risk of false positive
                             no_lifetime_params()
-                             {
+                        {
                             span_lint(cx, SHOULD_IMPLEMENT_TRAIT, impl_item.span, &format!(
                                 "defining a method called `{}` on this type; consider implementing \
                                 the `{}` trait or choosing a less ambiguous name", name, trait_name));