mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
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:
commit
fac59f4f28
2 changed files with 53 additions and 30 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue