aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_binder.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-19 16:22:00 +0100
committerAleksey Kladov <[email protected]>2019-07-19 16:22:00 +0100
commit5c594bcb48f01bdcf3068f72cefffda337a03533 (patch)
treebf584b2bf88a35ebe9e5c91392fecb23b4935c97 /crates/ra_hir/src/source_binder.rs
parent8718a47088585bdb411f37d1b7cd1244d7528eaa (diff)
cleanup casts
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r--crates/ra_hir/src/source_binder.rs14
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),