From: Tobin Harding Date: Thu, 6 May 2021 03:54:52 +0000 (+1000) Subject: Use `default: D` mirroring Rust documentation X-Git-Tag: v0.8.0~16 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/struct.EncoderStringWriter.html?a=commitdiff_plain;h=9aea90bd810171e868b365d3b97f2cc2988300fd;p=bdk 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`. --- 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> {