@@ -326,8 +326,7 @@ pub struct Terminator<'tcx> {
326
326
}
327
327
328
328
pub type Successors < ' a > = impl DoubleEndedIterator < Item = BasicBlock > + ' a ;
329
- pub type SuccessorsMut < ' a > =
330
- iter:: Chain < std:: option:: IntoIter < & ' a mut BasicBlock > , slice:: IterMut < ' a , BasicBlock > > ;
329
+ pub type SuccessorsMut < ' a > = impl DoubleEndedIterator < Item = & ' a mut BasicBlock > + ' a ;
331
330
332
331
impl < ' tcx > Terminator < ' tcx > {
333
332
pub fn successors ( & self ) -> Successors < ' _ > {
@@ -355,24 +354,24 @@ impl<'tcx> TerminatorKind<'tcx> {
355
354
pub fn successors ( & self ) -> Successors < ' _ > {
356
355
use self :: TerminatorKind :: * ;
357
356
match * self {
358
- Call { target : Some ( t) , unwind : UnwindAction :: Cleanup ( ref u) , .. }
359
- | Yield { resume : t, drop : Some ( ref u) , .. }
360
- | Drop { target : t, unwind : UnwindAction :: Cleanup ( ref u) , .. }
361
- | Assert { target : t, unwind : UnwindAction :: Cleanup ( ref u) , .. }
362
- | FalseUnwind { real_target : t, unwind : UnwindAction :: Cleanup ( ref u) }
363
- | InlineAsm { destination : Some ( t) , unwind : UnwindAction :: Cleanup ( ref u) , .. } => {
364
- Some ( t ) . into_iter ( ) . chain ( slice:: from_ref ( u ) . into_iter ( ) . copied ( ) )
365
- }
366
- Goto { target : t }
367
- | Call { target : None , unwind : UnwindAction :: Cleanup ( t) , .. }
368
- | Call { target : Some ( t) , unwind : _, .. }
369
- | Yield { resume : t, drop : None , .. }
370
- | Drop { target : t, unwind : _, .. }
371
- | Assert { target : t, unwind : _, .. }
372
- | FalseUnwind { real_target : t, unwind : _ }
373
- | InlineAsm { destination : None , unwind : UnwindAction :: Cleanup ( t) , .. }
374
- | InlineAsm { destination : Some ( t) , unwind : _, .. } => {
375
- Some ( t) . into_iter ( ) . chain ( ( & [ ] ) . into_iter ( ) . copied ( ) )
357
+ Call { target : Some ( ref t) , unwind : UnwindAction :: Cleanup ( u) , .. }
358
+ | Yield { resume : ref t, drop : Some ( u) , .. }
359
+ | Drop { target : ref t, unwind : UnwindAction :: Cleanup ( u) , .. }
360
+ | Assert { target : ref t, unwind : UnwindAction :: Cleanup ( u) , .. }
361
+ | FalseUnwind { real_target : ref t, unwind : UnwindAction :: Cleanup ( u) }
362
+ | InlineAsm { destination : Some ( ref t) , unwind : UnwindAction :: Cleanup ( u) , .. } => {
363
+ slice:: from_ref ( t ) . into_iter ( ) . copied ( ) . chain ( Some ( u ) )
364
+ }
365
+ Goto { target : ref t }
366
+ | Call { target : None , unwind : UnwindAction :: Cleanup ( ref t) , .. }
367
+ | Call { target : Some ( ref t) , unwind : _, .. }
368
+ | Yield { resume : ref t, drop : None , .. }
369
+ | Drop { target : ref t, unwind : _, .. }
370
+ | Assert { target : ref t, unwind : _, .. }
371
+ | FalseUnwind { real_target : ref t, unwind : _ }
372
+ | InlineAsm { destination : None , unwind : UnwindAction :: Cleanup ( ref t) , .. }
373
+ | InlineAsm { destination : Some ( ref t) , unwind : _, .. } => {
374
+ slice :: from_ref ( t) . into_iter ( ) . copied ( ) . chain ( None )
376
375
}
377
376
UnwindResume
378
377
| UnwindTerminate ( _)
@@ -381,14 +380,12 @@ impl<'tcx> TerminatorKind<'tcx> {
381
380
| Unreachable
382
381
| Call { target : None , unwind : _, .. }
383
382
| InlineAsm { destination : None , unwind : _, .. } => {
384
- None . into_iter ( ) . chain ( ( & [ ] ) . into_iter ( ) . copied ( ) )
383
+ ( & [ ] ) . into_iter ( ) . copied ( ) . chain ( None )
385
384
}
386
- SwitchInt { ref targets, .. } => {
387
- None . into_iter ( ) . chain ( targets. targets . iter ( ) . copied ( ) )
385
+ SwitchInt { ref targets, .. } => targets. targets . iter ( ) . copied ( ) . chain ( None ) ,
386
+ FalseEdge { ref real_target, imaginary_target } => {
387
+ slice:: from_ref ( real_target) . into_iter ( ) . copied ( ) . chain ( Some ( imaginary_target) )
388
388
}
389
- FalseEdge { real_target, ref imaginary_target } => Some ( real_target)
390
- . into_iter ( )
391
- . chain ( slice:: from_ref ( imaginary_target) . into_iter ( ) . copied ( ) ) ,
392
389
}
393
390
}
394
391
@@ -404,7 +401,7 @@ impl<'tcx> TerminatorKind<'tcx> {
404
401
destination : Some ( ref mut t) ,
405
402
unwind : UnwindAction :: Cleanup ( ref mut u) ,
406
403
..
407
- } => Some ( t) . into_iter ( ) . chain ( slice :: from_mut ( u) ) ,
404
+ } => slice :: from_mut ( t) . into_iter ( ) . chain ( Some ( u) ) ,
408
405
Goto { target : ref mut t }
409
406
| Call { target : None , unwind : UnwindAction :: Cleanup ( ref mut t) , .. }
410
407
| Call { target : Some ( ref mut t) , unwind : _, .. }
@@ -414,18 +411,18 @@ impl<'tcx> TerminatorKind<'tcx> {
414
411
| FalseUnwind { real_target : ref mut t, unwind : _ }
415
412
| InlineAsm { destination : None , unwind : UnwindAction :: Cleanup ( ref mut t) , .. }
416
413
| InlineAsm { destination : Some ( ref mut t) , unwind : _, .. } => {
417
- Some ( t) . into_iter ( ) . chain ( & mut [ ] )
414
+ slice :: from_mut ( t) . into_iter ( ) . chain ( None )
418
415
}
419
416
UnwindResume
420
417
| UnwindTerminate ( _)
421
418
| CoroutineDrop
422
419
| Return
423
420
| Unreachable
424
421
| Call { target : None , unwind : _, .. }
425
- | InlineAsm { destination : None , unwind : _, .. } => None . into_iter ( ) . chain ( & mut [ ] ) ,
426
- SwitchInt { ref mut targets, .. } => None . into_iter ( ) . chain ( & mut targets . targets ) ,
422
+ | InlineAsm { destination : None , unwind : _, .. } => ( & mut [ ] ) . into_iter ( ) . chain ( None ) ,
423
+ SwitchInt { ref mut targets, .. } => targets . targets . iter_mut ( ) . chain ( None ) ,
427
424
FalseEdge { ref mut real_target, ref mut imaginary_target } => {
428
- Some ( real_target) . into_iter ( ) . chain ( slice :: from_mut ( imaginary_target) )
425
+ slice :: from_mut ( real_target) . into_iter ( ) . chain ( Some ( imaginary_target) )
429
426
}
430
427
}
431
428
}
0 commit comments