11#![ allow( unused_imports) ]
22
3+ use crate :: Result ;
4+
35cfg_if:: cfg_if! {
46 if #[ cfg( all( feature = "reqwest" , feature = "cyper" ) ) ] {
57 compile_error!( "The 'reqwest' and 'cyper' features cannot be enabled at the same time. To use `cyper`, disable default feature first." ) ;
68 } else if #[ cfg( feature = "reqwest" ) ] {
7- pub ( crate ) use reqwest:: { Client , Error , Method , Response , StatusCode , Url , get, header, multipart} ;
9+ pub ( crate ) use reqwest:: { Client , Error , Method , Response , StatusCode , Url , RequestBuilder , get, header, multipart} ;
810 } else if #[ cfg( feature = "cyper" ) ] {
9- pub ( crate ) use cyper:: { Client , Response , Error , multipart} ;
11+ pub ( crate ) use cyper:: { Client , Response , Error , RequestBuilder , multipart} ;
1012 pub ( crate ) use url:: Url ;
1113 pub ( crate ) use http:: { Method , StatusCode , header} ;
1214 pub ( crate ) use cyper_ext:: * ;
@@ -17,17 +19,16 @@ cfg_if::cfg_if! {
1719
1820pub ( crate ) trait CheckError : Sized {
1921 type Ok ;
20- type Error ;
21- fn check ( self ) -> Result < Self :: Ok , Self :: Error > ;
22+
23+ fn check ( self ) -> Result < Self :: Ok > ;
2224}
2325
2426#[ cfg( feature = "reqwest" ) ]
2527impl CheckError for reqwest:: RequestBuilder {
26- type Error = reqwest:: Error ;
2728 type Ok = reqwest:: RequestBuilder ;
2829
2930 #[ inline( always) ]
30- fn check ( self ) -> Result < Self , Self :: Error > {
31+ fn check ( self ) -> Result < Self > {
3132 Ok ( self )
3233 }
3334}
@@ -56,12 +57,11 @@ mod cyper_ext {
5657 }
5758
5859 impl < T > CheckError for cyper:: Result < T > {
59- type Error = cyper:: Error ;
6060 type Ok = T ;
6161
6262 #[ inline( always) ]
63- fn check ( self ) -> Result < T , Self :: Error > {
64- self
63+ fn check ( self ) -> Result < T > {
64+ Ok ( self ? )
6565 }
6666 }
6767}
0 commit comments