File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ impl VisitMut for Scrub {
82
82
} ;
83
83
}
84
84
syn:: Expr :: Try ( try_expr) => {
85
+ syn:: visit_mut:: visit_expr_try_mut ( self , try_expr) ;
85
86
// let ident = &self.yielder;
86
87
let e = & try_expr. expr ;
87
88
Original file line number Diff line number Diff line change @@ -60,3 +60,21 @@ async fn convert_err() {
60
60
assert_eq ! ( 1 , values. len( ) ) ;
61
61
assert_eq ! ( Err ( ErrorB ( 1 ) ) , values[ 0 ] ) ;
62
62
}
63
+
64
+ #[ tokio:: test]
65
+ async fn multi_try ( ) {
66
+ fn test ( ) -> impl Stream < Item = Result < i32 , String > > {
67
+ try_stream ! {
68
+ let a = Ok :: <_, String >( Ok :: <_, String >( 123 ) ) ??;
69
+ for _ in ( 1 ..10 ) {
70
+ yield a;
71
+ }
72
+ }
73
+ }
74
+ let values: Vec < _ > = test ( ) . collect ( ) . await ;
75
+ assert_eq ! ( 9 , values. len( ) ) ;
76
+ assert_eq ! (
77
+ std:: iter:: repeat( 123 ) . take( 9 ) . map( Ok ) . collect:: <Vec <_>>( ) ,
78
+ values
79
+ ) ;
80
+ }
You can’t perform that action at this time.
0 commit comments