File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ fn run_instructions_with_single_pick_up(
102102
103103 // Move items one by one. Once could re-use loop-less solution from
104104 // [`run_instructions_with_multi_pick_up`], by just reversing the order
105- // of items returned by [`std::vec::Vec::drain `], but this way the
105+ // of items returned by [`std::vec::Vec::split_off `], but this way the
106106 // intention is much clearer
107107 for _ in 0 ..num {
108108 let v = stacks[ from]
@@ -130,7 +130,7 @@ fn run_instructions_with_multi_pick_up(
130130 . len ( )
131131 . checked_sub ( num)
132132 . ok_or_else ( || anyhow ! ( "stack {} has less than {} items left on it" , from, num) ) ?;
133- let mut v = stacks[ from] . drain ( idx_to_pick_up_from.. ) . collect ( ) ;
133+ let mut v = stacks[ from] . split_off ( idx_to_pick_up_from) ;
134134 stacks[ to] . append ( & mut v) ;
135135 }
136136
You can’t perform that action at this time.
0 commit comments