aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/utils.rs')
-rw-r--r--crates/ra_hir_ty/src/utils.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir_ty/src/utils.rs b/crates/ra_hir_ty/src/utils.rs
index b40d4eb73..1e5022fa4 100644
--- a/crates/ra_hir_ty/src/utils.rs
+++ b/crates/ra_hir_ty/src/utils.rs
@@ -201,11 +201,11 @@ impl Generics {
201 (parent, self_params, list_params, impl_trait_params) 201 (parent, self_params, list_params, impl_trait_params)
202 } 202 }
203 203
204 pub(crate) fn param_idx(&self, param: TypeParamId) -> Option<u32> { 204 pub(crate) fn param_idx(&self, param: TypeParamId) -> Option<usize> {
205 Some(self.find_param(param)?.0) 205 Some(self.find_param(param)?.0)
206 } 206 }
207 207
208 fn find_param(&self, param: TypeParamId) -> Option<(u32, &TypeParamData)> { 208 fn find_param(&self, param: TypeParamId) -> Option<(usize, &TypeParamData)> {
209 if param.parent == self.def { 209 if param.parent == self.def {
210 let (idx, (_local_id, data)) = self 210 let (idx, (_local_id, data)) = self
211 .params 211 .params
@@ -215,7 +215,7 @@ impl Generics {
215 .find(|(_, (idx, _))| *idx == param.local_id) 215 .find(|(_, (idx, _))| *idx == param.local_id)
216 .unwrap(); 216 .unwrap();
217 let (_total, parent_len, _child) = self.len_split(); 217 let (_total, parent_len, _child) = self.len_split();
218 Some(((parent_len + idx) as u32, data)) 218 Some((parent_len + idx, data))
219 } else { 219 } else {
220 self.parent_generics.as_ref().and_then(|g| g.find_param(param)) 220 self.parent_generics.as_ref().and_then(|g| g.find_param(param))
221 } 221 }