@@ -55,7 +55,7 @@ use crate::{
5555/// # Ok(())
5656/// # }
5757/// ```
58- #[ derive( Clone ) ]
58+ #[ derive( Clone , Debug ) ]
5959pub struct Proxy {
6060 extra : Extra ,
6161 intercept : Intercept ,
@@ -182,7 +182,10 @@ impl Proxy {
182182 /// # fn main() {}
183183 /// ```
184184 pub fn http < U : IntoProxy > ( proxy_scheme : U ) -> crate :: Result < Proxy > {
185- Ok ( Proxy :: new ( Intercept :: Http ( proxy_scheme. into_proxy ( ) ?) ) )
185+ proxy_scheme
186+ . into_proxy ( )
187+ . map ( Intercept :: Http )
188+ . map ( Proxy :: new)
186189 }
187190
188191 /// Proxy all HTTPS traffic to the passed URL.
@@ -200,7 +203,10 @@ impl Proxy {
200203 /// # fn main() {}
201204 /// ```
202205 pub fn https < U : IntoProxy > ( proxy_scheme : U ) -> crate :: Result < Proxy > {
203- Ok ( Proxy :: new ( Intercept :: Https ( proxy_scheme. into_proxy ( ) ?) ) )
206+ proxy_scheme
207+ . into_proxy ( )
208+ . map ( Intercept :: Https )
209+ . map ( Proxy :: new)
204210 }
205211
206212 /// Proxy **all** traffic to the passed URL.
@@ -221,7 +227,10 @@ impl Proxy {
221227 /// # fn main() {}
222228 /// ```
223229 pub fn all < U : IntoProxy > ( proxy_scheme : U ) -> crate :: Result < Proxy > {
224- Ok ( Proxy :: new ( Intercept :: All ( proxy_scheme. into_proxy ( ) ?) ) )
230+ proxy_scheme
231+ . into_proxy ( )
232+ . map ( Intercept :: All )
233+ . map ( Proxy :: new)
225234 }
226235
227236 fn new ( intercept : Intercept ) -> Proxy {
@@ -364,15 +373,6 @@ fn cache_maybe_has_http_custom_headers(url: &Url, extra: &Option<HeaderMap>) ->
364373 url. scheme ( ) == Scheme :: HTTP . as_str ( ) && extra. is_some ( )
365374}
366375
367- impl fmt:: Debug for Proxy {
368- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
369- f. debug_tuple ( "Proxy" )
370- . field ( & self . intercept )
371- . field ( & self . no_proxy )
372- . finish ( )
373- }
374- }
375-
376376impl NoProxy {
377377 /// Returns a new no-proxy configuration based on environment variables (or `None` if no
378378 /// variables are set) see [self::NoProxy::from_string()] for the string format
0 commit comments