You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Result and Option have map_or and map_or_else functions. In each case, the first parameter is used when the struct contains no value (or contains an error), while the second parameter is used when there is a value in the struct. The documentation mentions there parameters in the reverse order. This is confusing, as programmers expect parameter names to be documented in order.
I suggest reversing the wording.
I'll be submitting a PR with the change. If there are other classes or functions that have this issue, please leave a comment and I will change them as well.
The text was updated successfully, but these errors were encountered:
lefth
changed the title
Arguments are described in the reverse order for map_or and map_or_else
Docs: Arguments are described in the reverse order for map_or and map_or_else
Apr 27, 2021
lefth
added a commit
to lefth/rust
that referenced
this issue
Apr 27, 2021
Reorder the parameter descriptions of map_or and map_or_else
They were described backwards, probably leading users to write arguments in the wrong order. Bug: rust-lang#84608
Result and Option have map_or and map_or_else functions. In each case, the first parameter is used when the struct contains no value (or contains an error), while the second parameter is used when there is a value in the struct. The documentation mentions there parameters in the reverse order. This is confusing, as programmers expect parameter names to be documented in order.
I suggest reversing the wording.
I'll be submitting a PR with the change. If there are other classes or functions that have this issue, please leave a comment and I will change them as well.
The text was updated successfully, but these errors were encountered: