mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 17:28:09 +00:00
Use normal iteration instead of walk_mut
This commit is contained in:
parent
d4dc879415
commit
3fc344b9f1
1 changed files with 5 additions and 8 deletions
|
@ -206,23 +206,20 @@ pub(super) fn substs_from_path_segment(
|
|||
substs.push(Ty::Unknown);
|
||||
}
|
||||
assert_eq!(substs.len(), def_generics.count_params_including_parent());
|
||||
let mut substs = Substs(substs.into());
|
||||
|
||||
// handle defaults
|
||||
if let Some(def_generic) = def_generic {
|
||||
let default_substs = db.generic_defaults(def_generic);
|
||||
assert_eq!(substs.len(), default_substs.len());
|
||||
|
||||
let mut i = 0;
|
||||
substs.walk_mut(&mut |ty| {
|
||||
if *ty == Ty::Unknown {
|
||||
*ty = default_substs[i].clone();
|
||||
for (i, default_ty) in default_substs.iter().enumerate() {
|
||||
if substs[i] == Ty::Unknown {
|
||||
substs[i] = default_ty.clone();
|
||||
}
|
||||
i += 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
substs
|
||||
Substs(substs.into())
|
||||
}
|
||||
|
||||
impl TraitRef {
|
||||
|
|
Loading…
Reference in a new issue