Merge #6195
6195: Shorten iterators in associated params r=matklad a=SomeoneToIgnore Applies the same iterator-shortening logic to the iterator associated types, recursively. Before:  After: <img width="1192" alt="image" src="https://user-images.githubusercontent.com/2690773/95662894-e9038080-0b42-11eb-897d-527571ccac58.png"> Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
@@ -1389,7 +1389,7 @@ impl Type {
|
||||
r#trait: Trait,
|
||||
args: &[Type],
|
||||
alias: TypeAlias,
|
||||
) -> Option<Ty> {
|
||||
) -> Option<Type> {
|
||||
let subst = Substs::build_for_def(db, r#trait.id)
|
||||
.push(self.ty.value.clone())
|
||||
.fill(args.iter().map(|t| t.ty.value.clone()))
|
||||
@@ -1410,6 +1410,10 @@ impl Type {
|
||||
Solution::Unique(SolutionVariables(subst)) => subst.value.first().cloned(),
|
||||
Solution::Ambig(_) => None,
|
||||
}
|
||||
.map(|ty| Type {
|
||||
krate: self.krate,
|
||||
ty: InEnvironment { value: ty, environment: Arc::clone(&self.ty.environment) },
|
||||
})
|
||||
}
|
||||
|
||||
pub fn is_copy(&self, db: &dyn HirDatabase) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user