mismatching_type_param_order: Delay macro check.

This commit is contained in:
Jason Newcomb 2024-06-13 19:00:18 -04:00
parent 36a14e3a12
commit 58aa804ada

View File

@ -49,12 +49,12 @@
impl<'tcx> LateLintPass<'tcx> for TypeParamMismatch { impl<'tcx> LateLintPass<'tcx> for TypeParamMismatch {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) { fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
if !item.span.from_expansion() if let ItemKind::Impl(imp) = &item.kind
&& let ItemKind::Impl(imp) = &item.kind
&& let TyKind::Path(QPath::Resolved(_, path)) = &imp.self_ty.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 && let Some(generic_args) = segment.args
&& !generic_args.args.is_empty() && !generic_args.args.is_empty()
&& !item.span.from_expansion()
{ {
// get the name and span of the generic parameters in the Impl // get the name and span of the generic parameters in the Impl
let mut impl_params = Vec::new(); let mut impl_params = Vec::new();