2929//!
3030//! // See API documentation for why this is `unsafe`
3131//! let client = match unsafe { Client::from_env() } {
32- //! Ok (client) => client,
33- //! Err(_) => panic!("client not configured"),
32+ //! Some (client) => client,
33+ //! None => panic!("client not configured"),
3434//! };
3535//! ```
3636//!
@@ -269,7 +269,7 @@ impl Client {
269269 ///
270270 /// Note, though, that on Windows it should be safe to call this function
271271 /// any number of times.
272- pub unsafe fn from_env ( ) -> Result < Client , ErrFromEnv > {
272+ pub unsafe fn from_env_ext ( ) -> Result < Client , ErrFromEnv > {
273273 let ( env, var) = [ "CARGO_MAKEFLAGS" , "MAKEFLAGS" , "MFLAGS" ]
274274 . iter ( )
275275 . map ( |& env| env:: var ( env) . map ( |var| ( env, var) ) )
@@ -289,6 +289,14 @@ impl Client {
289289 }
290290 }
291291
292+ /// Attempts to connect to the jobserver specified in this process's
293+ /// environment.
294+ ///
295+ /// Wraps `from_env_ext` and discards error details.
296+ pub unsafe fn from_env ( ) -> Option < Client > {
297+ Self :: from_env_ext ( ) . ok ( )
298+ }
299+
292300 /// Acquires a token from this jobserver client.
293301 ///
294302 /// This function will block the calling thread until a new token can be
0 commit comments