diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2024-06-13 19:00:18 -0400 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2024-07-07 22:06:15 -0400 |
| commit | 58aa804ada9c13e8e5e89e6f25594d52ba835816 (patch) | |
| tree | fb8a957d98e3a617bbe3087777b7f7c5775c269b | |
| parent | 36a14e3a12c41f8bdf7087d350a454d6fe05e29d (diff) | |
| download | rust-58aa804ada9c13e8e5e89e6f25594d52ba835816.tar.gz rust-58aa804ada9c13e8e5e89e6f25594d52ba835816.zip | |
`mismatching_type_param_order`: Delay macro check.
| -rw-r--r-- | clippy_lints/src/mismatching_type_param_order.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/mismatching_type_param_order.rs b/clippy_lints/src/mismatching_type_param_order.rs index 934b9f490ad..748289454be 100644 --- a/clippy_lints/src/mismatching_type_param_order.rs +++ b/clippy_lints/src/mismatching_type_param_order.rs @@ -49,12 +49,12 @@ declare_lint_pass!(TypeParamMismatch => [MISMATCHING_TYPE_PARAM_ORDER]); impl<'tcx> LateLintPass<'tcx> for TypeParamMismatch { fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) { - if !item.span.from_expansion() - && let ItemKind::Impl(imp) = &item.kind + if let ItemKind::Impl(imp) = &item.kind && let TyKind::Path(QPath::Resolved(_, path)) = &imp.self_ty.kind - && let Some(segment) = path.segments.iter().next() + && let [segment, ..] = path.segments && let Some(generic_args) = segment.args && !generic_args.args.is_empty() + && !item.span.from_expansion() { // get the name and span of the generic parameters in the Impl let mut impl_params = Vec::new(); |
