mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-20 14:14:49 +01:00
refactor: remove the use of flat maps
This commit is contained in:
@@ -287,7 +287,10 @@ FROM mint_quote
|
||||
.await
|
||||
.map_err(Error::from)?;
|
||||
|
||||
let mint_quotes = rec.into_iter().flat_map(sqlite_row_to_mint_quote).collect();
|
||||
let mint_quotes = rec
|
||||
.into_iter()
|
||||
.map(sqlite_row_to_mint_quote)
|
||||
.collect::<Result<Vec<MintQuote>, _>>()?;
|
||||
|
||||
Ok(mint_quotes)
|
||||
}
|
||||
@@ -362,7 +365,10 @@ FROM melt_quote
|
||||
.await
|
||||
.map_err(Error::from)?;
|
||||
|
||||
let melt_quotes = rec.into_iter().flat_map(sqlite_row_to_melt_quote).collect();
|
||||
let melt_quotes = rec
|
||||
.into_iter()
|
||||
.map(sqlite_row_to_melt_quote)
|
||||
.collect::<Result<Vec<mint::MeltQuote>, _>>()?;
|
||||
|
||||
Ok(melt_quotes)
|
||||
}
|
||||
@@ -477,8 +483,8 @@ FROM keyset;
|
||||
|
||||
Ok(recs
|
||||
.into_iter()
|
||||
.flat_map(sqlite_row_to_keyset_info)
|
||||
.collect())
|
||||
.map(sqlite_row_to_keyset_info)
|
||||
.collect::<Result<_, _>>()?)
|
||||
}
|
||||
|
||||
async fn add_proofs(&self, proofs: Proofs) -> Result<(), Self::Err> {
|
||||
@@ -733,8 +739,8 @@ WHERE keyset_id=?;
|
||||
let signatures = rec
|
||||
.map_err(Error::from)?
|
||||
.into_iter()
|
||||
.flat_map(sqlite_row_to_blind_signature)
|
||||
.collect();
|
||||
.map(sqlite_row_to_blind_signature)
|
||||
.collect::<Result<_, _>>()?;
|
||||
|
||||
Ok(signatures)
|
||||
}
|
||||
|
||||
@@ -272,7 +272,10 @@ WHERE mint_url=?
|
||||
},
|
||||
};
|
||||
|
||||
let keysets: Vec<KeySetInfo> = recs.iter().flat_map(sqlite_row_to_keyset).collect();
|
||||
let keysets = recs
|
||||
.iter()
|
||||
.map(sqlite_row_to_keyset)
|
||||
.collect::<Result<Vec<KeySetInfo>, _>>()?;
|
||||
|
||||
match keysets.is_empty() {
|
||||
false => Ok(Some(keysets)),
|
||||
@@ -363,7 +366,10 @@ FROM mint_quote
|
||||
.await
|
||||
.map_err(Error::from)?;
|
||||
|
||||
let mint_quotes = rec.iter().flat_map(sqlite_row_to_mint_quote).collect();
|
||||
let mint_quotes = rec
|
||||
.iter()
|
||||
.map(sqlite_row_to_mint_quote)
|
||||
.collect::<Result<_, _>>()?;
|
||||
|
||||
Ok(mint_quotes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user