File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
crates/matrix-sdk-ui/src/spaces Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -69,12 +69,13 @@ impl SpaceGraph {
69
69
/// Adds a directed edge from `parent_id` to `child_id`, creating nodes if
70
70
/// they do not already exist in the graph.
71
71
pub ( super ) fn add_edge ( & mut self , parent_id : OwnedRoomId , child_id : OwnedRoomId ) {
72
- self . nodes . entry ( parent_id. clone ( ) ) . or_insert ( SpaceGraphNode :: new ( parent_id. clone ( ) ) ) ;
72
+ let parent_entry =
73
+ self . nodes . entry ( parent_id. clone ( ) ) . or_insert ( SpaceGraphNode :: new ( parent_id. clone ( ) ) ) ;
74
+ parent_entry. children . insert ( child_id. clone ( ) ) ;
73
75
74
- self . nodes . entry ( child_id. clone ( ) ) . or_insert ( SpaceGraphNode :: new ( child_id. clone ( ) ) ) ;
75
-
76
- self . nodes . get_mut ( & parent_id) . unwrap ( ) . children . insert ( child_id. clone ( ) ) ;
77
- self . nodes . get_mut ( & child_id) . unwrap ( ) . parents . insert ( parent_id) ;
76
+ let child_entry =
77
+ self . nodes . entry ( child_id. clone ( ) ) . or_insert ( SpaceGraphNode :: new ( child_id) ) ;
78
+ child_entry. parents . insert ( parent_id) ;
78
79
}
79
80
80
81
/// Removes cycles in the graph by performing a depth-first search (DFS) and
You can’t perform that action at this time.
0 commit comments