From 704305d3a07031f31926786d7e767a4792aee172 Mon Sep 17 00:00:00 2001 From: shamardy Date: Thu, 19 Sep 2024 04:24:28 +0300 Subject: [PATCH] review fix: add note about `ok_or` usage for `Constructible` --- mm2src/mm2_main/src/lp_wallet.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm2src/mm2_main/src/lp_wallet.rs b/mm2src/mm2_main/src/lp_wallet.rs index e24d5b6fbd..d4546ffb72 100644 --- a/mm2src/mm2_main/src/lp_wallet.rs +++ b/mm2src/mm2_main/src/lp_wallet.rs @@ -537,6 +537,8 @@ impl From for GetWalletsError { /// Retrieves all created wallets and the currently activated wallet. pub async fn get_wallet_names_rpc(ctx: MmArc, _req: Json) -> MmResult { let wallets = read_all_wallet_names(&ctx).await?; + // Note: `ok_or` is used here on `Constructible>` to handle the case where the wallet name is not set. + // `wallet_name` can be `None` in the case of no-login mode. let activated_wallet = ctx.wallet_name.ok_or(GetWalletsError::Internal( "`wallet_name` not initialized yet!".to_string(), ))?;