1
Fork 0

Use newtype for unused generic parameters

This commit is contained in:
Nilstrieb 2022-12-01 18:57:53 +01:00
parent 89e0576bd3
commit 2855794257
10 changed files with 65 additions and 33 deletions

View file

@ -40,12 +40,11 @@ where
let index = index
.try_into()
.expect("more generic parameters than can fit into a `u32`");
let is_used = unused_params.contains(index).map_or(true, |unused| !unused);
// Only recurse when generic parameters in fns, closures and generators
// are used and require substitution.
// Just in case there are closures or generators within this subst,
// recurse.
if is_used && subst.needs_subst() {
if unused_params.is_used(index) && subst.needs_subst() {
return subst.visit_with(self);
}
}