]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/use_self.rs
Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup
[rust.git] / src / tools / clippy / clippy_lints / src / use_self.rs
index f85db1e2006e8e77327d2bc2e35d6bde02fea0a7..776c6bc57ca6f857c4d86b699d99a4d5f2351f41 100644 (file)
@@ -167,14 +167,11 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
             if let TyKind::Path(QPath::Resolved(_, ref item_path)) = item_type.kind;
             then {
                 let parameters = &item_path.segments.last().expect(SEGMENTS_MSG).args;
-                let should_check = if let Some(ref params) = *parameters {
-                    !params.parenthesized && !params.args.iter().any(|arg| match arg {
-                        GenericArg::Lifetime(_) => true,
-                        _ => false,
-                    })
-                } else {
-                    true
-                };
+                let should_check = parameters.as_ref().map_or(
+                    true,
+                    |params| !params.parenthesized
+                        &&!params.args.iter().any(|arg| matches!(arg, GenericArg::Lifetime(_)))
+                );
 
                 if should_check {
                     let visitor = &mut UseSelfVisitor {