Better Option handling
This commit is contained in:
parent
1bc49a9743
commit
e995a91a31
|
@ -334,11 +334,8 @@ macro_rules! define_dep_nodes {
|
|||
pub fn extract_def_id(&self, tcx: TyCtxt) -> Option<DefId> {
|
||||
if self.kind.can_reconstruct_query_key() {
|
||||
let def_path_hash = DefPathHash(self.hash);
|
||||
if let Some(ref def_path_map) = tcx.def_path_hash_to_def_id.as_ref() {
|
||||
def_path_map.get(&def_path_hash).cloned()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
tcx.def_path_hash_to_def_id.as_ref()?
|
||||
.get(&def_path_hash).cloned()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -489,7 +489,12 @@ impl DepGraph {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -47,7 +47,7 @@ impl<T: ExactSizeIterator> EnumerateAndAdjustIterator for T {
|
|||
let actual_len = self.len();
|
||||
EnumerateAndAdjust {
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue