@@ -260,29 +260,25 @@ where
260260 Input : Container ,
261261 Output : SizableContainer
262262 + ConsolidateLayout
263- + PushInto < Input :: Item < ' a > >
264- + PushInto < Input :: ItemRef < ' a > > ,
263+ + PushInto < Input :: Item < ' a > > ,
265264{
266265 fn push_into ( & mut self , container : & ' a mut Input ) {
267266 self . pending . ensure_capacity ( & mut None ) ;
268267
269- let form_batch = |this : & mut Self | {
270- if this. pending . at_capacity ( ) {
271- let starting_len = this. pending . len ( ) ;
272- consolidate_container ( & mut this. pending , & mut this. empty ) ;
273- std:: mem:: swap ( & mut this. pending , & mut this. empty ) ;
274- this. empty . clear ( ) ;
275- if this. pending . len ( ) > starting_len / 2 {
268+ for item in container. drain ( ) {
269+ self . pending . push ( item) ;
270+ if self . pending . at_capacity ( ) {
271+ let starting_len = self . pending . len ( ) ;
272+ consolidate_container ( & mut self . pending , & mut self . empty ) ;
273+ std:: mem:: swap ( & mut self . pending , & mut self . empty ) ;
274+ self . empty . clear ( ) ;
275+ if self . pending . len ( ) > starting_len / 2 {
276276 // Note that we're pushing non-full containers, which is a deviation from
277277 // other implementation. The reason for this is that we cannot extract
278278 // partial data from `this.pending`. We should revisit this in the future.
279- this . ready . push_back ( std:: mem:: take ( & mut this . pending ) ) ;
279+ self . ready . push_back ( std:: mem:: take ( & mut self . pending ) ) ;
280280 }
281281 }
282- } ;
283- for item in container. drain ( ) {
284- self . pending . push ( item) ;
285- form_batch ( self ) ;
286282 }
287283 }
288284}
0 commit comments