diff --git a/core/src/mast/merger/mod.rs b/core/src/mast/merger/mod.rs index 7802f7a01..c497f0cad 100644 --- a/core/src/mast/merger/mod.rs +++ b/core/src/mast/merger/mod.rs @@ -142,7 +142,7 @@ impl MastForestMerger { }; decorator_id_remapping - .insert(DecoratorId::new_unsafe(merging_id as u32), new_decorator_id); + .insert(DecoratorId::new_unchecked(merging_id as u32), new_decorator_id); } self.decorator_id_mappings.push(decorator_id_remapping); diff --git a/core/src/mast/mod.rs b/core/src/mast/mod.rs index e9cf9f36d..a105ae996 100644 --- a/core/src/mast/mod.rs +++ b/core/src/mast/mod.rs @@ -533,7 +533,7 @@ impl MastNodeId { } /// Returns a new [`MastNodeId`] from the given `value` without checking its validity. - pub(crate) fn new_unsafe(value: u32) -> Self { + pub(crate) fn new_unchecked(value: u32) -> Self { Self(value) } @@ -599,7 +599,7 @@ impl DecoratorId { } /// Creates a new [`DecoratorId`] without checking its validity. - pub(crate) fn new_unsafe(value: u32) -> Self { + pub(crate) fn new_unchecked(value: u32) -> Self { Self(value) } diff --git a/core/src/mast/multi_forest_node_iterator.rs b/core/src/mast/multi_forest_node_iterator.rs index efa7534b8..daaf8bf51 100644 --- a/core/src/mast/multi_forest_node_iterator.rs +++ b/core/src/mast/multi_forest_node_iterator.rs @@ -102,7 +102,7 @@ impl<'forest> MultiMastForestNodeIter<'forest> { for (node_idx, node) in forest.nodes().iter().enumerate() { // SAFETY: The passed id comes from the iterator over the nodes, so we never exceed // the forest's number of nodes. - let node_id = MastNodeId::new_unsafe(node_idx as u32); + let node_id = MastNodeId::new_unchecked(node_idx as u32); if !node.is_external() { non_external_nodes.insert(node.digest(), (forest_idx, node_id)); } @@ -419,7 +419,7 @@ mod tests { nodes[0], MultiMastForestIteratorItem::Node { forest_idx: 1, - node_id: MastNodeId::new_unsafe(2) + node_id: MastNodeId::new_unchecked(2) } ); // The external node replaced by the block foo from forest B. @@ -427,9 +427,9 @@ mod tests { nodes[1], MultiMastForestIteratorItem::ExternalNodeReplacement { replacement_forest_idx: 1, - replacement_mast_node_id: MastNodeId::new_unsafe(2), + replacement_mast_node_id: MastNodeId::new_unchecked(2), replaced_forest_idx: 0, - replaced_mast_node_id: MastNodeId::new_unsafe(0) + replaced_mast_node_id: MastNodeId::new_unchecked(0) } ); // The call from forest A. @@ -437,7 +437,7 @@ mod tests { nodes[2], MultiMastForestIteratorItem::Node { forest_idx: 0, - node_id: MastNodeId::new_unsafe(1) + node_id: MastNodeId::new_unchecked(1) } ); // The replacement for the external node that is replaced by the Call in forest A. @@ -445,9 +445,9 @@ mod tests { nodes[3], MultiMastForestIteratorItem::ExternalNodeReplacement { replacement_forest_idx: 0, - replacement_mast_node_id: MastNodeId::new_unsafe(1), + replacement_mast_node_id: MastNodeId::new_unchecked(1), replaced_forest_idx: 1, - replaced_mast_node_id: MastNodeId::new_unsafe(0) + replaced_mast_node_id: MastNodeId::new_unchecked(0) } ); // The call from forest B. @@ -455,7 +455,7 @@ mod tests { nodes[4], MultiMastForestIteratorItem::Node { forest_idx: 1, - node_id: MastNodeId::new_unsafe(1) + node_id: MastNodeId::new_unchecked(1) } ); }