Clean up old usages of NodeId(generate_uuid()) by replacing it with NodeId::new() (#2009)

Replace all `NodeId(generate_uuid())` with `NodeId::new()`
This commit is contained in:
Mohamed Osama
2024-10-26 05:43:46 +03:00
committed by GitHub
parent dae6b2f239
commit 3c839ffd2b
21 changed files with 46 additions and 61 deletions

View File

@@ -73,7 +73,6 @@ mod uuid_generation {
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Serialize, serde::Deserialize, specta::Type, DynAny)]
pub struct NodeId(pub u64);
// TODO: Find and replace all `NodeId(generate_uuid())` with `NodeId::new()`.
impl NodeId {
pub fn new() -> Self {
Self(generate_uuid())

View File

@@ -747,11 +747,11 @@ fn migrate_layer_to_merge<'de, D: serde::Deserializer<'de>>(deserializer: D) ->
}
// TODO: Eventually remove this (probably starting late 2024)
fn default_import_metadata() -> (NodeId, IVec2) {
(NodeId(generate_uuid()), IVec2::new(-25, -4))
(NodeId::new(), IVec2::new(-25, -4))
}
// TODO: Eventually remove this (probably starting late 2024)
fn default_export_metadata() -> (NodeId, IVec2) {
(NodeId(generate_uuid()), IVec2::new(8, -4))
(NodeId::new(), IVec2::new(8, -4))
}
#[derive(Clone, Default, Debug, DynAny)]
@@ -1016,7 +1016,7 @@ impl NodeNetwork {
/// Remove all nodes that contain [`DocumentNodeImplementation::Network`] by moving the nested nodes into the parent network.
pub fn flatten(&mut self, node_id: NodeId) {
self.flatten_with_fns(node_id, merge_ids, || NodeId(generate_uuid()))
self.flatten_with_fns(node_id, merge_ids, || NodeId::new())
}
/// Remove all nodes that contain [`DocumentNodeImplementation::Network`] by moving the nested nodes into the parent network.