File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
src/librustc_data_structures/obligation_forest Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -348,15 +348,16 @@ impl<O: ForestObligation> ObligationForest<O> {
348348
349349 /// Converts all remaining obligations to the given error.
350350 pub fn to_errors < E : Clone > ( & mut self , error : E ) -> Vec < Error < O , E > > {
351- let mut errors = vec ! [ ] ;
352- for ( index , node) in self . nodes . iter ( ) . enumerate ( ) {
353- if let NodeState :: Pending = node . state . get ( ) {
354- errors . push ( Error {
351+ let errors = self . nodes . iter ( ) . enumerate ( )
352+ . filter ( | ( _index , node) | node . state . get ( ) == NodeState :: Pending )
353+ . map ( | ( index , _node ) | {
354+ Error {
355355 error : error. clone ( ) ,
356356 backtrace : self . error_at ( index) ,
357- } ) ;
358- }
359- }
357+ }
358+ } )
359+ . collect ( ) ;
360+
360361 let successful_obligations = self . compress ( DoCompleted :: Yes ) ;
361362 assert ! ( successful_obligations. unwrap( ) . is_empty( ) ) ;
362363 errors
@@ -366,10 +367,9 @@ impl<O: ForestObligation> ObligationForest<O> {
366367 pub fn map_pending_obligations < P , F > ( & self , f : F ) -> Vec < P >
367368 where F : Fn ( & O ) -> P
368369 {
369- self . nodes
370- . iter ( )
371- . filter ( |n| n. state . get ( ) == NodeState :: Pending )
372- . map ( |n| f ( & n. obligation ) )
370+ self . nodes . iter ( )
371+ . filter ( |node| node. state . get ( ) == NodeState :: Pending )
372+ . map ( |node| f ( & node. obligation ) )
373373 . collect ( )
374374 }
375375
You can’t perform that action at this time.
0 commit comments