mirror of
https://github.com/mat-1/azalea.git
synced 2024-09-20 07:02:31 +00:00
replace an expect with unwrap_or_else
This commit is contained in:
parent
329f8b1784
commit
5ae890f941
2 changed files with 3 additions and 5 deletions
|
@ -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 {
|
||||
|
|
|
@ -122,7 +122,6 @@ where
|
|||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// use anyhow::Result;
|
||||
/// use azalea::prelude::*;
|
||||
///
|
||||
/// async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> {
|
||||
|
|
Loading…
Reference in a new issue