@@ -55,3 +55,44 @@ fn test_similarly_named_function() {
55
55
forget ( & SomeStruct ) ; //OK; call to unrelated function which happens to have the same name
56
56
std:: mem:: forget ( & SomeStruct ) ;
57
57
}
58
+
59
+ #[ derive( Copy , Clone ) ]
60
+ pub struct Error ;
61
+ fn produce_half_owl_error ( ) -> Result < ( ) , Error > {
62
+ Ok ( ( ) )
63
+ }
64
+
65
+ fn produce_half_owl_ok ( ) -> Result < bool , ( ) > {
66
+ Ok ( true )
67
+ }
68
+
69
+ #[ allow( dead_code) ]
70
+ fn test_owl_result ( ) -> Result < ( ) , ( ) > {
71
+
72
+ produce_half_owl_error ( ) . map_err ( |_| ( ) ) ?;
73
+ produce_half_owl_ok ( ) . map ( |_| ( ) ) ?;
74
+ // the following should not be linted,
75
+ // we should not force users to use toilet closures
76
+ // to produce owl results when drop is more convenient
77
+ produce_half_owl_error ( ) . map_err ( drop) ?;
78
+ produce_half_owl_ok ( ) . map_err ( drop) ?;
79
+ Ok ( ( ) )
80
+ }
81
+
82
+
83
+ #[ allow( dead_code) ]
84
+ fn test_owl_result_2 ( ) -> Result < u8 , ( ) > {
85
+ #[ derive( Copy , Clone ) ]
86
+ pub struct Error ;
87
+ fn produce_result ( ) -> Result < ( ) , Error > {
88
+ Ok ( ( ) )
89
+ }
90
+ produce_half_owl_error ( ) . map_err ( |_| ( ) ) ?;
91
+ produce_half_owl_ok ( ) . map ( |_| ( ) ) ?;
92
+ // the following should not be linted,
93
+ // we should not force users to use toilet closures
94
+ // to produce owl results when drop is more convenient
95
+ produce_half_owl_error ( ) . map_err ( drop) ?;
96
+ produce_half_owl_ok ( ) . map ( drop) ?;
97
+ Ok ( 1 )
98
+ }
0 commit comments