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
ameknite opened this issue
Feb 3, 2023
· 1 comment
· Fixed by #107632
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.
I think it would be nice if the .map() documentation made it clear that when None is consumed by .map() returns None, to make it consistent with .map_or() and .map_or_else() because right now it just says:
Maps an Option<T> to Option<U> by applying a function to a contained value.
Example in .map.or()
"Returns the provided default result (if none), or applies a function to the contained value (if any)."
let x: Option<&str> = None;
assert_eq!(x.map(|s| s.len()), None);
The text was updated successfully, but these errors were encountered:
ameknite
added
the
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
label
Feb 3, 2023
jyn514
added
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
labels
Feb 3, 2023
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.
Location
https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.map
Summary
I think it would be nice if the .map() documentation made it clear that when None is consumed by .map() returns None, to make it consistent with .map_or() and .map_or_else() because right now it just says:
Example in .map.or()
https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.map_or.
and maybe add a little example like:
The text was updated successfully, but these errors were encountered: