mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
internal: Make block_def_map infallible
This commit is contained in:
parent
10e0aaf284
commit
c32d51979d
9 changed files with 32 additions and 60 deletions
|
@ -129,10 +129,7 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
|
|||
let impl_maps = [in_deps, in_self];
|
||||
let block_impls = iter::successors(self.block, |&block_id| {
|
||||
cov_mark::hit!(block_local_impls);
|
||||
self.db
|
||||
.block_def_map(block_id)
|
||||
.and_then(|map| map.parent())
|
||||
.and_then(|module| module.containing_block())
|
||||
self.db.block_def_map(block_id).parent().and_then(|module| module.containing_block())
|
||||
})
|
||||
.inspect(|&block_id| {
|
||||
// make sure we don't search the same block twice
|
||||
|
|
|
@ -156,7 +156,7 @@ impl TraitImpls {
|
|||
let _p = profile::span("trait_impls_in_block_query");
|
||||
let mut impls = Self { map: FxHashMap::default() };
|
||||
|
||||
let block_def_map = db.block_def_map(block)?;
|
||||
let block_def_map = db.block_def_map(block);
|
||||
impls.collect_def_map(db, &block_def_map);
|
||||
impls.shrink_to_fit();
|
||||
|
||||
|
@ -290,7 +290,7 @@ impl InherentImpls {
|
|||
let _p = profile::span("inherent_impls_in_block_query");
|
||||
let mut impls = Self { map: FxHashMap::default(), invalid_impls: Vec::default() };
|
||||
|
||||
let block_def_map = db.block_def_map(block)?;
|
||||
let block_def_map = db.block_def_map(block);
|
||||
impls.collect_def_map(db, &block_def_map);
|
||||
impls.shrink_to_fit();
|
||||
|
||||
|
@ -1191,10 +1191,7 @@ fn iterate_inherent_methods(
|
|||
)?;
|
||||
}
|
||||
|
||||
block = db
|
||||
.block_def_map(block_id)
|
||||
.and_then(|map| map.parent())
|
||||
.and_then(|module| module.containing_block());
|
||||
block = db.block_def_map(block_id).parent().and_then(|module| module.containing_block());
|
||||
}
|
||||
|
||||
for krate in def_crates {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue