mirror of
https://github.com/chatmail/core.git
synced 2026-05-16 13:26:38 +03:00
Reduce unwrap and expect usage
This commit is contained in:
@@ -141,9 +141,10 @@ impl Accounts {
|
||||
|
||||
/// Remove an account.
|
||||
pub async fn remove_account(&mut self, id: u32) -> Result<()> {
|
||||
let ctx = self.accounts.remove(&id);
|
||||
ensure!(ctx.is_some(), "no account with this id: {}", id);
|
||||
let ctx = ctx.unwrap();
|
||||
let ctx = self
|
||||
.accounts
|
||||
.remove(&id)
|
||||
.with_context(|| format!("no account with id {}", id))?;
|
||||
ctx.stop_io().await;
|
||||
drop(ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user