@@ -166,12 +166,16 @@ where
166
166
167
167
match ready ! ( this. in_progress_queue. poll_next_unpin( cx) ) {
168
168
Some ( ( weight, id, output) ) => {
169
- * this. current_global_weight = this. current_global_weight . checked_sub ( weight) . unwrap_or_else ( || {
170
- panic ! (
171
- "future_queue_grouped: subtracted weight {weight} from current {}, overflowed" ,
169
+ * this. current_global_weight = this
170
+ . current_global_weight
171
+ . checked_sub ( weight)
172
+ . unwrap_or_else ( || {
173
+ panic ! (
174
+ "future_queue_grouped: subtracted weight {} from current {}, overflowed" ,
175
+ weight,
172
176
this. current_global_weight,
173
177
)
174
- } ) ;
178
+ } ) ;
175
179
176
180
let mut any_queued = false ;
177
181
@@ -183,14 +187,21 @@ where
183
187
while data. current_weight < data. max_weight
184
188
&& this. current_global_weight < this. max_global_weight
185
189
{
186
- let Some ( ( weight, id, future) ) = data. queued . pop_front ( ) else { break } ;
190
+ let ( weight, id, future) = match data. queued . pop_front ( ) {
191
+ Some ( x) => x,
192
+ None => break ,
193
+ } ;
187
194
data. add_weight ( & id, weight) ;
188
- * this. current_global_weight = this. current_global_weight . checked_add ( weight) . unwrap_or_else ( || {
189
- panic ! (
190
- "future_queue_grouped: added weight {weight} to current {}, overflowed" ,
195
+ * this. current_global_weight = this
196
+ . current_global_weight
197
+ . checked_add ( weight)
198
+ . unwrap_or_else ( || {
199
+ panic ! (
200
+ "future_queue_grouped: added weight {} to current {}, overflowed" ,
201
+ weight,
191
202
this. current_global_weight,
192
203
)
193
- } ) ;
204
+ } ) ;
194
205
this. in_progress_queue
195
206
. as_mut ( )
196
207
. get_pin_mut ( )
@@ -240,7 +251,8 @@ where
240
251
data. add_weight ( & id, weight) ;
241
252
* this. current_global_weight = this. current_global_weight . checked_add ( weight) . unwrap_or_else ( || {
242
253
panic ! (
243
- "future_queue_grouped: added weight {weight} to current {}, overflowed" ,
254
+ "future_queue_grouped: added weight {} to current {}, overflowed" ,
255
+ weight,
244
256
this. current_global_weight,
245
257
)
246
258
} ) ;
@@ -276,7 +288,7 @@ where
276
288
if any_queued {
277
289
// Start any futures that were just queued up. If this returns Pending, then that's fine --
278
290
// the task will be scheduled on the waker.
279
- _ = this. in_progress_queue . as_mut ( ) . poll_peek ( cx) ;
291
+ let _ = this. in_progress_queue . as_mut ( ) . poll_peek ( cx) ;
280
292
}
281
293
282
294
if let Some ( output) = return_output {
@@ -310,7 +322,7 @@ where
310
322
if any_queued {
311
323
// It's possible that poll_pop_in_progress might have added more futures to the queue.
312
324
let this = self . project ( ) ;
313
- _ = this. in_progress_queue . poll_peek ( cx) ;
325
+ let _ = this. in_progress_queue . poll_peek ( cx) ;
314
326
}
315
327
Poll :: Ready ( output)
316
328
}
@@ -368,7 +380,8 @@ where
368
380
self . group_data . get_mut ( id) . unwrap ( )
369
381
} else {
370
382
panic ! (
371
- "unknown semaphore ID: {id:?} (known IDs: {:?})" ,
383
+ "unknown semaphore ID: {:?} (known IDs: {:?})" ,
384
+ id,
372
385
self . group_data. keys( )
373
386
) ;
374
387
}
@@ -391,17 +404,17 @@ impl<Q: fmt::Debug, Fut> GroupData<Q, Fut> {
391
404
fn add_weight ( & mut self , id : & Q , weight : usize ) {
392
405
self . current_weight = self . current_weight . checked_add ( weight) . unwrap_or_else ( || {
393
406
panic ! (
394
- "future_queue_grouped: for id `{id :?}`, added weight {weight } to current {}, overflowed" ,
395
- self . current_weight,
407
+ "future_queue_grouped: for id `{:?}`, added weight {} to current {}, overflowed" ,
408
+ id , weight , self . current_weight,
396
409
)
397
410
} ) ;
398
411
}
399
412
400
413
fn sub_weight ( & mut self , id : & Q , weight : usize ) {
401
414
self . current_weight = self . current_weight . checked_sub ( weight) . unwrap_or_else ( || {
402
415
panic ! (
403
- "future_queue_grouped: for id `{id :?}`, subtracted weight {weight } from current {}, underflowed" ,
404
- self . current_weight,
416
+ "future_queue_grouped: for id `{:?}`, sub weight {} from current {}, underflowed" ,
417
+ id , weight , self . current_weight,
405
418
)
406
419
} ) ;
407
420
}
0 commit comments