Skip to content

Commit

Permalink
Fix for aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
MinerSebas committed May 8, 2024
1 parent f50c2fe commit 7b81aa9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mixed_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl<'tcx> MixedTy<'tcx> {
_ => return None,
};

let hir_generics: Vec<_> = match self.hir {
let mut hir_generics: Vec<_> = match self.hir {
Either::Left(ty) => match &ty.kind {
rustc_hir::TyKind::Path(q_path) => clippy_utils::qpath_generic_tys(q_path)
.map(Either::Left)
Expand All @@ -197,7 +197,12 @@ impl<'tcx> MixedTy<'tcx> {
.collect(),
};

assert_eq!(hir_generics.len(), middle_generics.len());
// Fix for aliases
if hir_generics.len() == 0 && middle_generics.len() != 0 {
hir_generics = std::iter::repeat(Either::Right(self.span()))
.take(middle_generics.len())
.collect();
}

let vec = hir_generics
.iter()
Expand Down

0 comments on commit 7b81aa9

Please sign in to comment.