From 9aea90bd810171e868b365d3b97f2cc2988300fd Mon Sep 17 00:00:00 2001 From: Tobin Harding Date: Thu, 6 May 2021 13:54:52 +1000 Subject: [PATCH] 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`. --- src/database/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/database/mod.rs b/src/database/mod.rs index 6955111f..84eb511e 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -164,14 +164,14 @@ pub(crate) trait DatabaseUtils: Database { .map(|o| o.is_some()) } - fn get_raw_tx_or(&self, txid: &Txid, f: F) -> Result, Error> + fn get_raw_tx_or(&self, txid: &Txid, default: D) -> Result, Error> where - F: FnOnce() -> Result, Error>, + D: FnOnce() -> Result, Error>, { self.get_tx(txid, true)? .map(|t| t.transaction) .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, Error> {