Skip to content

Commit cb19848

Browse files
committed
worker/jobs/expiry_notification: Replace match statement with ok_or_else()
1 parent d8b2aad commit cb19848

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/worker/jobs/expiry_notification.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ fn handle_expiring_token(
5959
emails: &Emails,
6060
) -> Result<(), anyhow::Error> {
6161
let user = User::find(conn, token.user_id)?;
62-
let recipient = match user.email(conn)? {
63-
Some(email) => email,
64-
None => return Err(anyhow!("No address found")),
65-
};
62+
let recipient = user
63+
.email(conn)?
64+
.ok_or_else(|| anyhow!("No address found"))?;
6665
let email = ExpiryNotificationEmail {
6766
name: &user.gh_login,
6867
token_name: &token.name,

0 commit comments

Comments
 (0)