@@ -336,8 +336,7 @@ pub struct Terminator<'tcx> {
336
336
}
337
337
338
338
pub type Successors < ' a > = impl DoubleEndedIterator < Item = BasicBlock > + ' a ;
339
- pub type SuccessorsMut < ' a > =
340
- iter:: Chain < std:: option:: IntoIter < & ' a mut BasicBlock > , slice:: IterMut < ' a , BasicBlock > > ;
339
+ pub type SuccessorsMut < ' a > = impl DoubleEndedIterator < Item = & ' a mut BasicBlock > + ' a ;
341
340
342
341
impl < ' tcx > Terminator < ' tcx > {
343
342
#[ inline]
@@ -371,24 +370,24 @@ impl<'tcx> TerminatorKind<'tcx> {
371
370
pub fn successors ( & self ) -> Successors < ' _ > {
372
371
use self :: TerminatorKind :: * ;
373
372
match * self {
374
- Call { target : Some ( t) , unwind : UnwindAction :: Cleanup ( ref u) , .. }
375
- | Yield { resume : t, drop : Some ( ref u) , .. }
376
- | Drop { target : t, unwind : UnwindAction :: Cleanup ( ref u) , .. }
377
- | Assert { target : t, unwind : UnwindAction :: Cleanup ( ref u) , .. }
378
- | FalseUnwind { real_target : t, unwind : UnwindAction :: Cleanup ( ref u) }
379
- | InlineAsm { destination : Some ( t) , unwind : UnwindAction :: Cleanup ( ref u) , .. } => {
380
- Some ( t ) . into_iter ( ) . chain ( slice:: from_ref ( u ) . into_iter ( ) . copied ( ) )
381
- }
382
- Goto { target : t }
383
- | Call { target : None , unwind : UnwindAction :: Cleanup ( t) , .. }
384
- | Call { target : Some ( t) , unwind : _, .. }
385
- | Yield { resume : t, drop : None , .. }
386
- | Drop { target : t, unwind : _, .. }
387
- | Assert { target : t, unwind : _, .. }
388
- | FalseUnwind { real_target : t, unwind : _ }
389
- | InlineAsm { destination : None , unwind : UnwindAction :: Cleanup ( t) , .. }
390
- | InlineAsm { destination : Some ( t) , unwind : _, .. } => {
391
- Some ( t) . into_iter ( ) . chain ( ( & [ ] ) . into_iter ( ) . copied ( ) )
373
+ Call { target : Some ( ref t) , unwind : UnwindAction :: Cleanup ( u) , .. }
374
+ | Yield { resume : ref t, drop : Some ( u) , .. }
375
+ | Drop { target : ref t, unwind : UnwindAction :: Cleanup ( u) , .. }
376
+ | Assert { target : ref t, unwind : UnwindAction :: Cleanup ( u) , .. }
377
+ | FalseUnwind { real_target : ref t, unwind : UnwindAction :: Cleanup ( u) }
378
+ | InlineAsm { destination : Some ( ref t) , unwind : UnwindAction :: Cleanup ( u) , .. } => {
379
+ slice:: from_ref ( t ) . into_iter ( ) . copied ( ) . chain ( Some ( u ) )
380
+ }
381
+ Goto { target : ref t }
382
+ | Call { target : None , unwind : UnwindAction :: Cleanup ( ref t) , .. }
383
+ | Call { target : Some ( ref t) , unwind : _, .. }
384
+ | Yield { resume : ref t, drop : None , .. }
385
+ | Drop { target : ref t, unwind : _, .. }
386
+ | Assert { target : ref t, unwind : _, .. }
387
+ | FalseUnwind { real_target : ref t, unwind : _ }
388
+ | InlineAsm { destination : None , unwind : UnwindAction :: Cleanup ( ref t) , .. }
389
+ | InlineAsm { destination : Some ( ref t) , unwind : _, .. } => {
390
+ slice :: from_ref ( t) . into_iter ( ) . copied ( ) . chain ( None )
392
391
}
393
392
UnwindResume
394
393
| UnwindTerminate ( _)
@@ -397,14 +396,12 @@ impl<'tcx> TerminatorKind<'tcx> {
397
396
| Unreachable
398
397
| Call { target : None , unwind : _, .. }
399
398
| InlineAsm { destination : None , unwind : _, .. } => {
400
- None . into_iter ( ) . chain ( ( & [ ] ) . into_iter ( ) . copied ( ) )
399
+ ( & [ ] ) . into_iter ( ) . copied ( ) . chain ( None )
401
400
}
402
- SwitchInt { ref targets, .. } => {
403
- None . into_iter ( ) . chain ( targets. targets . iter ( ) . copied ( ) )
401
+ SwitchInt { ref targets, .. } => targets. targets . iter ( ) . copied ( ) . chain ( None ) ,
402
+ FalseEdge { ref real_target, imaginary_target } => {
403
+ slice:: from_ref ( real_target) . into_iter ( ) . copied ( ) . chain ( Some ( imaginary_target) )
404
404
}
405
- FalseEdge { real_target, ref imaginary_target } => Some ( real_target)
406
- . into_iter ( )
407
- . chain ( slice:: from_ref ( imaginary_target) . into_iter ( ) . copied ( ) ) ,
408
405
}
409
406
}
410
407
@@ -421,7 +418,7 @@ impl<'tcx> TerminatorKind<'tcx> {
421
418
destination : Some ( ref mut t) ,
422
419
unwind : UnwindAction :: Cleanup ( ref mut u) ,
423
420
..
424
- } => Some ( t) . into_iter ( ) . chain ( slice :: from_mut ( u) ) ,
421
+ } => slice :: from_mut ( t) . into_iter ( ) . chain ( Some ( u) ) ,
425
422
Goto { target : ref mut t }
426
423
| Call { target : None , unwind : UnwindAction :: Cleanup ( ref mut t) , .. }
427
424
| Call { target : Some ( ref mut t) , unwind : _, .. }
@@ -431,18 +428,18 @@ impl<'tcx> TerminatorKind<'tcx> {
431
428
| FalseUnwind { real_target : ref mut t, unwind : _ }
432
429
| InlineAsm { destination : None , unwind : UnwindAction :: Cleanup ( ref mut t) , .. }
433
430
| InlineAsm { destination : Some ( ref mut t) , unwind : _, .. } => {
434
- Some ( t) . into_iter ( ) . chain ( & mut [ ] )
431
+ slice :: from_mut ( t) . into_iter ( ) . chain ( None )
435
432
}
436
433
UnwindResume
437
434
| UnwindTerminate ( _)
438
435
| CoroutineDrop
439
436
| Return
440
437
| Unreachable
441
438
| Call { target : None , unwind : _, .. }
442
- | InlineAsm { destination : None , unwind : _, .. } => None . into_iter ( ) . chain ( & mut [ ] ) ,
443
- SwitchInt { ref mut targets, .. } => None . into_iter ( ) . chain ( & mut targets . targets ) ,
439
+ | InlineAsm { destination : None , unwind : _, .. } => ( & mut [ ] ) . into_iter ( ) . chain ( None ) ,
440
+ SwitchInt { ref mut targets, .. } => targets . targets . iter_mut ( ) . chain ( None ) ,
444
441
FalseEdge { ref mut real_target, ref mut imaginary_target } => {
445
- Some ( real_target) . into_iter ( ) . chain ( slice :: from_mut ( imaginary_target) )
442
+ slice :: from_mut ( real_target) . into_iter ( ) . chain ( Some ( imaginary_target) )
446
443
}
447
444
}
448
445
}
0 commit comments