Better Option handling
This commit is contained in:
parent
1bc49a9743
commit
e995a91a31
3 changed files with 9 additions and 7 deletions
|
@ -334,11 +334,8 @@ macro_rules! define_dep_nodes {
|
||||||
pub fn extract_def_id(&self, tcx: TyCtxt) -> Option<DefId> {
|
pub fn extract_def_id(&self, tcx: TyCtxt) -> Option<DefId> {
|
||||||
if self.kind.can_reconstruct_query_key() {
|
if self.kind.can_reconstruct_query_key() {
|
||||||
let def_path_hash = DefPathHash(self.hash);
|
let def_path_hash = DefPathHash(self.hash);
|
||||||
if let Some(ref def_path_map) = tcx.def_path_hash_to_def_id.as_ref() {
|
tcx.def_path_hash_to_def_id.as_ref()?
|
||||||
def_path_map.get(&def_path_hash).cloned()
|
.get(&def_path_hash).cloned()
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,7 +489,12 @@ impl DepGraph {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn dep_node_debug_str(&self, dep_node: DepNode) -> Option<String> {
|
pub(super) fn dep_node_debug_str(&self, dep_node: DepNode) -> Option<String> {
|
||||||
self.data.as_ref().and_then(|t| t.dep_node_debug.borrow().get(&dep_node).cloned())
|
self.data
|
||||||
|
.as_ref()?
|
||||||
|
.dep_node_debug
|
||||||
|
.borrow()
|
||||||
|
.get(&dep_node)
|
||||||
|
.cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn edge_deduplication_data(&self) -> (u64, u64) {
|
pub fn edge_deduplication_data(&self) -> (u64, u64) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ impl<T: ExactSizeIterator> EnumerateAndAdjustIterator for T {
|
||||||
let actual_len = self.len();
|
let actual_len = self.len();
|
||||||
EnumerateAndAdjust {
|
EnumerateAndAdjust {
|
||||||
enumerate: self.enumerate(),
|
enumerate: self.enumerate(),
|
||||||
gap_pos: if let Some(gap_pos) = gap_pos { gap_pos } else { expected_len },
|
gap_pos: gap_pos.unwrap_or(expected_len),
|
||||||
gap_len: expected_len - actual_len,
|
gap_len: expected_len - actual_len,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue