1
Fork 0

When giving a suggestion to use :: instead of . where the rhs is a macro giving a type,

make it also work when the rhs is a type alias, not just a struct.
This commit is contained in:
Zachary S 2025-01-31 16:28:25 -06:00
parent bfde43c84b
commit ae7b45a6d4
3 changed files with 137 additions and 4 deletions

View file

@ -1529,7 +1529,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
Applicability::MaybeIncorrect,
);
true
} else if kind == DefKind::Struct
} else if matches!(kind, DefKind::Struct | DefKind::TyAlias)
&& let Some(lhs_source_span) = lhs_span.find_ancestor_inside(expr.span)
&& let Ok(snippet) = this.r.tcx.sess.source_map().span_to_snippet(lhs_source_span)
{