diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 14 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index 7c3839388..94c5124a9 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -49,14 +49,14 @@ impl CrateImplBlocks { | |||
49 | .into_iter() | 49 | .into_iter() |
50 | .flat_map(|i| i.iter()) | 50 | .flat_map(|i| i.iter()) |
51 | .map(move |(module_id, impl_id)| { | 51 | .map(move |(module_id, impl_id)| { |
52 | let module_impl_blocks = db.impls_in_module(self.source_root_id, *module_id)?; | 52 | let module_impl_blocks = db.impls_in_module(self.source_root_id, *module_id); |
53 | Ok(ImplBlock::from_id(module_impl_blocks, *impl_id)) | 53 | Ok(ImplBlock::from_id(module_impl_blocks, *impl_id)) |
54 | }) | 54 | }) |
55 | } | 55 | } |
56 | 56 | ||
57 | fn collect_recursive(&mut self, db: &impl HirDatabase, module: Module) -> Cancelable<()> { | 57 | fn collect_recursive(&mut self, db: &impl HirDatabase, module: Module) -> Cancelable<()> { |
58 | let module_id = module.def_id.loc(db).module_id; | 58 | let module_id = module.def_id.loc(db).module_id; |
59 | let module_impl_blocks = db.impls_in_module(self.source_root_id, module_id)?; | 59 | let module_impl_blocks = db.impls_in_module(self.source_root_id, module_id); |
60 | 60 | ||
61 | for (impl_id, impl_data) in module_impl_blocks.impls.iter() { | 61 | for (impl_id, impl_data) in module_impl_blocks.impls.iter() { |
62 | let impl_block = ImplBlock::from_id(Arc::clone(&module_impl_blocks), impl_id); | 62 | let impl_block = ImplBlock::from_id(Arc::clone(&module_impl_blocks), impl_id); |
@@ -75,7 +75,7 @@ impl CrateImplBlocks { | |||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | for child in module.children(db)? { | 78 | for child in module.children(db) { |
79 | self.collect_recursive(db, child)?; | 79 | self.collect_recursive(db, child)?; |
80 | } | 80 | } |
81 | 81 | ||
@@ -93,17 +93,17 @@ impl CrateImplBlocks { | |||
93 | source_root_id, | 93 | source_root_id, |
94 | impls: FxHashMap::default(), | 94 | impls: FxHashMap::default(), |
95 | }; | 95 | }; |
96 | if let Some(module) = krate.root_module(db)? { | 96 | if let Some(module) = krate.root_module(db) { |
97 | crate_impl_blocks.collect_recursive(db, module)?; | 97 | crate_impl_blocks.collect_recursive(db, module)?; |
98 | } | 98 | } |
99 | Ok(Arc::new(crate_impl_blocks)) | 99 | Ok(Arc::new(crate_impl_blocks)) |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | fn def_crate(db: &impl HirDatabase, ty: &Ty) -> Cancelable<Option<Crate>> { | 103 | fn def_crate(db: &impl HirDatabase, ty: &Ty) -> Option<Crate> { |
104 | match ty { | 104 | match ty { |
105 | Ty::Adt { def_id, .. } => def_id.krate(db), | 105 | Ty::Adt { def_id, .. } => def_id.krate(db), |
106 | _ => Ok(None), | 106 | _ => None, |
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
@@ -139,7 +139,7 @@ impl Ty { | |||
139 | // rustc does an autoderef and then autoref again). | 139 | // rustc does an autoderef and then autoref again). |
140 | 140 | ||
141 | for derefed_ty in self.autoderef(db) { | 141 | for derefed_ty in self.autoderef(db) { |
142 | let krate = match def_crate(db, &derefed_ty)? { | 142 | let krate = match def_crate(db, &derefed_ty) { |
143 | Some(krate) => krate, | 143 | Some(krate) => krate, |
144 | None => continue, | 144 | None => continue, |
145 | }; | 145 | }; |
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index b81d91e80..b44ac9987 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -322,7 +322,7 @@ fn infer(content: &str) -> String { | |||
322 | { | 322 | { |
323 | let func = source_binder::function_from_source(&db, file_id, fn_def).unwrap(); | 323 | let func = source_binder::function_from_source(&db, file_id, fn_def).unwrap(); |
324 | let inference_result = func.infer(&db).unwrap(); | 324 | let inference_result = func.infer(&db).unwrap(); |
325 | let body_syntax_mapping = func.body_syntax_mapping(&db).unwrap(); | 325 | let body_syntax_mapping = func.body_syntax_mapping(&db); |
326 | let mut types = Vec::new(); | 326 | let mut types = Vec::new(); |
327 | for (pat, ty) in inference_result.type_of_pat.iter() { | 327 | for (pat, ty) in inference_result.type_of_pat.iter() { |
328 | let syntax_ptr = match body_syntax_mapping.pat_syntax(pat) { | 328 | let syntax_ptr = match body_syntax_mapping.pat_syntax(pat) { |