@@ -17,7 +17,7 @@ pub async fn graphql_sync<CtxT, QueryT, MutationT, SubscriptionT, S>(
1717 root_node : Arc < RootNode < ' static , QueryT , MutationT , SubscriptionT , S > > ,
1818 context : Arc < CtxT > ,
1919 req : Request < Body > ,
20- ) -> Result < Response < Body > , hyper :: Error >
20+ ) -> Response < Body >
2121where
2222 QueryT : GraphQLType < S , Context = CtxT > ,
2323 QueryT :: TypeInfo : Sync ,
@@ -28,17 +28,17 @@ where
2828 CtxT : Sync ,
2929 S : ScalarValue + Send + Sync ,
3030{
31- Ok ( match parse_req ( req) . await {
31+ match parse_req ( req) . await {
3232 Ok ( req) => execute_request_sync ( root_node, context, req) . await ,
3333 Err ( resp) => resp,
34- } )
34+ }
3535}
3636
3737pub async fn graphql < CtxT , QueryT , MutationT , SubscriptionT , S > (
3838 root_node : Arc < RootNode < ' static , QueryT , MutationT , SubscriptionT , S > > ,
3939 context : Arc < CtxT > ,
4040 req : Request < Body > ,
41- ) -> Result < Response < Body > , hyper :: Error >
41+ ) -> Response < Body >
4242where
4343 QueryT : GraphQLTypeAsync < S , Context = CtxT > ,
4444 QueryT :: TypeInfo : Sync ,
@@ -49,10 +49,10 @@ where
4949 CtxT : Sync ,
5050 S : ScalarValue + Send + Sync ,
5151{
52- Ok ( match parse_req ( req) . await {
52+ match parse_req ( req) . await {
5353 Ok ( req) => execute_request ( root_node, context, req) . await ,
5454 Err ( resp) => resp,
55- } )
55+ }
5656}
5757
5858async fn parse_req < S : ScalarValue > (
@@ -121,26 +121,26 @@ async fn parse_post_graphql_req<S: ScalarValue>(
121121pub async fn graphiql (
122122 graphql_endpoint : & str ,
123123 subscriptions_endpoint : Option < & str > ,
124- ) -> Result < Response < Body > , hyper :: Error > {
124+ ) -> Response < Body > {
125125 let mut resp = new_html_response ( StatusCode :: OK ) ;
126126 // XXX: is the call to graphiql_source blocking?
127127 * resp. body_mut ( ) = Body :: from ( juniper:: http:: graphiql:: graphiql_source (
128128 graphql_endpoint,
129129 subscriptions_endpoint,
130130 ) ) ;
131- Ok ( resp)
131+ resp
132132}
133133
134134pub async fn playground (
135135 graphql_endpoint : & str ,
136136 subscriptions_endpoint : Option < & str > ,
137- ) -> Result < Response < Body > , hyper :: Error > {
137+ ) -> Response < Body > {
138138 let mut resp = new_html_response ( StatusCode :: OK ) ;
139139 * resp. body_mut ( ) = Body :: from ( juniper:: http:: playground:: playground_source (
140140 graphql_endpoint,
141141 subscriptions_endpoint,
142142 ) ) ;
143- Ok ( resp)
143+ resp
144144}
145145
146146fn render_error ( err : GraphQLRequestError ) -> Response < Body > {
@@ -321,7 +321,7 @@ mod tests {
321321 EmptyMutation , EmptySubscription , RootNode ,
322322 } ;
323323 use reqwest:: { self , blocking:: Response as ReqwestResponse } ;
324- use std:: { net:: SocketAddr , sync:: Arc , thread, time:: Duration } ;
324+ use std:: { convert :: Infallible , net:: SocketAddr , sync:: Arc , thread, time:: Duration } ;
325325
326326 struct TestHyperIntegration {
327327 port : u16 ,
@@ -404,7 +404,7 @@ mod tests {
404404 }
405405 } ;
406406 async move {
407- if matches {
407+ Ok :: < _ , Infallible > ( if matches {
408408 if is_sync {
409409 super :: graphql_sync ( root_node, ctx, req) . await
410410 } else {
@@ -413,8 +413,8 @@ mod tests {
413413 } else {
414414 let mut resp = Response :: new ( Body :: empty ( ) ) ;
415415 * resp. status_mut ( ) = StatusCode :: NOT_FOUND ;
416- Ok ( resp)
417- }
416+ resp
417+ } )
418418 }
419419 } ) )
420420 }
0 commit comments