Use default: D
mirroring Rust documentation
Currently we use `F: f` for the argument that is the default function passed to `map_or_else` and pass a closure for the second argument. This bent my brain while reading the documentation because the docs use `default: D` for the first and `f: F` for the second. Although this is totally trivial it makes deciphering the combinator chain easier if we name the arguments the same way the Rust docs do. Use `default: D` for the identifier of the default function passed into `map_or_else`.
This commit is contained in:
parent
3c7bae9ce9
commit
9aea90bd81
@ -164,14 +164,14 @@ pub(crate) trait DatabaseUtils: Database {
|
|||||||
.map(|o| o.is_some())
|
.map(|o| o.is_some())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_raw_tx_or<F>(&self, txid: &Txid, f: F) -> Result<Option<Transaction>, Error>
|
fn get_raw_tx_or<D>(&self, txid: &Txid, default: D) -> Result<Option<Transaction>, Error>
|
||||||
where
|
where
|
||||||
F: FnOnce() -> Result<Option<Transaction>, Error>,
|
D: FnOnce() -> Result<Option<Transaction>, Error>,
|
||||||
{
|
{
|
||||||
self.get_tx(txid, true)?
|
self.get_tx(txid, true)?
|
||||||
.map(|t| t.transaction)
|
.map(|t| t.transaction)
|
||||||
.flatten()
|
.flatten()
|
||||||
.map_or_else(f, |t| Ok(Some(t)))
|
.map_or_else(default, |t| Ok(Some(t)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_previous_output(&self, outpoint: &OutPoint) -> Result<Option<TxOut>, Error> {
|
fn get_previous_output(&self, outpoint: &OutPoint) -> Result<Option<TxOut>, Error> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user