Skip to content

Conversation

@tcharding
Copy link
Contributor

@tcharding tcharding commented May 6, 2021

Description

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.

ref: https://doc.rust-lang.org/std/result/enum.Result.html#method.map_or_else

pub fn map_or_else<U, D, F>(self, default: D, f: F) -> U where
    F: FnOnce(T) -> U,
    D: FnOnce(E) -> U, 

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

@tcharding tcharding marked this pull request as draft May 6, 2021 04:49
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`.
@tcharding tcharding force-pushed the use-default-for-fn-identifier branch from 3bb9321 to 9aea90b Compare May 6, 2021 23:08
@tcharding tcharding marked this pull request as ready for review May 6, 2021 23:09
@afilini afilini merged commit 9aea90b into bitcoindevkit:master May 7, 2021
@tcharding tcharding deleted the use-default-for-fn-identifier branch May 10, 2021 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants