diff options
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 55eb7da35..df67d2c39 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -309,15 +309,11 @@ impl SourceAnalyzer { | |||
309 | crate::Resolution::LocalBinding(it) => { | 309 | crate::Resolution::LocalBinding(it) => { |
310 | // We get a `PatId` from resolver, but it actually can only | 310 | // We get a `PatId` from resolver, but it actually can only |
311 | // point at `BindPat`, and not at the arbitrary pattern. | 311 | // point at `BindPat`, and not at the arbitrary pattern. |
312 | let pat_ptr = self.body_source_map.as_ref()?.pat_syntax(it)?; | 312 | let pat_ptr = self |
313 | let pat_ptr = match pat_ptr { | 313 | .body_source_map |
314 | Either::A(pat) => { | 314 | .as_ref()? |
315 | let pat: AstPtr<ast::BindPat> = | 315 | .pat_syntax(it)? |
316 | pat.cast_checking_kind(|kind| kind == BIND_PAT).unwrap(); | 316 | .map_a(|ptr| ptr.cast::<ast::BindPat>().unwrap()); |
317 | Either::A(pat) | ||
318 | } | ||
319 | Either::B(self_param) => Either::B(self_param), | ||
320 | }; | ||
321 | PathResolution::LocalBinding(pat_ptr) | 317 | PathResolution::LocalBinding(pat_ptr) |
322 | } | 318 | } |
323 | crate::Resolution::GenericParam(it) => PathResolution::GenericParam(it), | 319 | crate::Resolution::GenericParam(it) => PathResolution::GenericParam(it), |