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
/// avoid confusion.
pub async fn microsoft(email: &str) -> Result<Self, azalea_auth::AuthError> {
let minecraft_dir = get_mc_dir::minecraft_dir().expect(
format!(
let minecraft_dir = get_mc_dir::minecraft_dir().unwrap_or_else(|| {
panic!(
"No {} environment variable found",
get_mc_dir::home_env_var()
)
.as_str(),
);
});
let auth_result = azalea_auth::auth(
email,
azalea_auth::AuthOpts {

View file

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