File tree 1 file changed +35
-0
lines changed
1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -55,3 +55,38 @@ 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
+ produce_half_owl_error ( ) . map_err ( |_| ( ) ) ?;
72
+ produce_half_owl_ok ( ) . map ( |_| ( ) ) ?;
73
+ // the following should not be linted,
74
+ // we should not force users to use toilet closures
75
+ // to produce owl results when drop is more convenient
76
+ produce_half_owl_error ( ) . map_err ( drop) ?;
77
+ produce_half_owl_ok ( ) . map_err ( drop) ?;
78
+ Ok ( ( ) )
79
+ }
80
+
81
+
82
+ #[ allow( dead_code) ]
83
+ fn test_owl_result_2 ( ) -> Result < u8 , ( ) > {
84
+ produce_half_owl_error ( ) . map_err ( |_| ( ) ) ?;
85
+ produce_half_owl_ok ( ) . map ( |_| ( ) ) ?;
86
+ // the following should not be linted,
87
+ // we should not force users to use toilet closures
88
+ // to produce owl results when drop is more convenient
89
+ produce_half_owl_error ( ) . map_err ( drop) ?;
90
+ produce_half_owl_ok ( ) . map ( drop) ?;
91
+ Ok ( 1 )
92
+ }
You can’t perform that action at this time.
0 commit comments