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
|
/// 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 {
|
||||||
|
|
|
@ -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<()> {
|
||||||
|
|
Loading…
Reference in a new issue