File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -439,4 +439,22 @@ fn test_option_get_or_insert() {
439439 //~^ or_fun_call
440440}
441441
442+ fn test_option_and() {
443+ // assume that this is slow call
444+ fn g() -> Option<u8> {
445+ Some(99)
446+ }
447+ let mut x = Some(42_u8);
448+ let _ = x.and(g());
449+ }
450+
451+ fn test_result_and() {
452+ // assume that this is slow call
453+ fn g() -> Result<u8, ()> {
454+ Ok(99)
455+ }
456+ let mut x: Result<u8, ()> = Ok(42);
457+ let _ = x.and(g());
458+ }
459+
442460fn main() {}
Original file line number Diff line number Diff line change @@ -439,4 +439,22 @@ fn test_option_get_or_insert() {
439439 //~^ or_fun_call
440440}
441441
442+ fn test_option_and ( ) {
443+ // assume that this is slow call
444+ fn g ( ) -> Option < u8 > {
445+ Some ( 99 )
446+ }
447+ let mut x = Some ( 42_u8 ) ;
448+ let _ = x. and ( g ( ) ) ;
449+ }
450+
451+ fn test_result_and ( ) {
452+ // assume that this is slow call
453+ fn g ( ) -> Result < u8 , ( ) > {
454+ Ok ( 99 )
455+ }
456+ let mut x: Result < u8 , ( ) > = Ok ( 42 ) ;
457+ let _ = x. and ( g ( ) ) ;
458+ }
459+
442460fn main ( ) { }
You can’t perform that action at this time.
0 commit comments