aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authoradamrk <[email protected]>2020-06-20 10:53:55 +0100
committeradamrk <[email protected]>2020-06-20 10:53:55 +0100
commitd8f5192d99886c89418879cc7d81ba298b0596db (patch)
treef737bb1f7e9f26be44a1a9cde8dcbb9858533740 /crates
parentf07338bae2e4209d5e47e69f131bfa9efc56c890 (diff)
Get Output assoc type by name
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_ty/src/infer/expr.rs16
1 files changed, 3 insertions, 13 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs
index 359befe4f..171330274 100644
--- a/crates/ra_hir_ty/src/infer/expr.rs
+++ b/crates/ra_hir_ty/src/infer/expr.rs
@@ -10,7 +10,7 @@ use hir_def::{
10 resolver::resolver_for_expr, 10 resolver::resolver_for_expr,
11 AdtId, AssocContainerId, FieldId, Lookup, 11 AdtId, AssocContainerId, FieldId, Lookup,
12}; 12};
13use hir_expand::name::Name; 13use hir_expand::name::{name, Name};
14use ra_syntax::ast::RangeOp; 14use ra_syntax::ast::RangeOp;
15 15
16use crate::{ 16use crate::{
@@ -70,18 +70,8 @@ impl<'a> InferenceContext<'a> {
70 .filter_map(|f| f.get_id(self.db, krate)) 70 .filter_map(|f| f.get_id(self.db, krate))
71 .collect(); 71 .collect();
72 let fn_once_trait = FnTrait::FnOnce.get_id(self.db, krate)?; 72 let fn_once_trait = FnTrait::FnOnce.get_id(self.db, krate)?;
73 let output_assoc_type = match self 73 let output_assoc_type =
74 .db 74 self.db.trait_data(fn_once_trait).associated_type_by_name(&name![Output])?;
75 .trait_data(fn_once_trait)
76 .associated_types()
77 .collect::<Vec<hir_def::TypeAliasId>>()
78 .as_slice()
79 {
80 [output] => *output,
81 _ => {
82 return None;
83 }
84 };
85 for fn_trait in fn_traits { 75 for fn_trait in fn_traits {
86 let generic_params = generics(self.db.upcast(), fn_trait.into()); 76 let generic_params = generics(self.db.upcast(), fn_trait.into());
87 if generic_params.len() != 2 { 77 if generic_params.len() != 2 {