replace an expect with unwrap_or_else

This commit is contained in:
mat 2022-10-30 15:42:43 -05:00
parent 329f8b1784
commit 5ae890f941
2 changed files with 3 additions and 5 deletions

View file

@ -46,13 +46,12 @@ impl Account {
/// a key for the cache, but it's recommended to use the real email to /// a key for the cache, but it's recommended to use the real email to
/// avoid confusion. /// avoid confusion.
pub async fn microsoft(email: &str) -> Result<Self, azalea_auth::AuthError> { pub async fn microsoft(email: &str) -> Result<Self, azalea_auth::AuthError> {
let minecraft_dir = get_mc_dir::minecraft_dir().expect( let minecraft_dir = get_mc_dir::minecraft_dir().unwrap_or_else(|| {
format!( panic!(
"No {} environment variable found", "No {} environment variable found",
get_mc_dir::home_env_var() get_mc_dir::home_env_var()
) )
.as_str(), });
);
let auth_result = azalea_auth::auth( let auth_result = azalea_auth::auth(
email, email,
azalea_auth::AuthOpts { azalea_auth::AuthOpts {

View file

@ -122,7 +122,6 @@ where
/// # Examples /// # Examples
/// ///
/// ```rust /// ```rust
/// use anyhow::Result;
/// use azalea::prelude::*; /// use azalea::prelude::*;
/// ///
/// async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> { /// async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> {