File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -898,21 +898,21 @@ fn assign_branch_columns(
898898 group_occ[ found] . push ( ( start, end) ) ;
899899 }
900900
901- let group_offset : Vec < usize > = occupied
902- . iter ( )
903- . scan ( 0 , | acc, group| {
904- * acc += group . len ( ) ;
905- Some ( * acc)
906- } )
907- . collect ( ) ;
901+ // Compute start column of each group
902+ let group_offset : Vec < usize > ;
903+ let mut acc = 0 ;
904+ for group in occupied {
905+ group_offset . push ( acc) ;
906+ acc += group . len ( ) ;
907+ }
908908
909+ // Compute branch column. Up till now we have computed the branch group
910+ // and the column offset within that group. This was to make it easy to
911+ // insert columns between groups. Now it is time to convert offset relative
912+ // to the group the final column.
909913 for branch in branches {
910914 if let Some ( column) = branch. visual . column {
911- let offset = if branch. visual . order_group == 0 {
912- 0
913- } else {
914- group_offset[ branch. visual . order_group - 1 ]
915- } ;
915+ let offset = group_offset[ branch. visual . order_group ] ;
916916 branch. visual . column = Some ( column + offset) ;
917917 }
918918 }
You can’t perform that action at this time.
0 commit comments