Closed
Description
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:
Maps an
Option<T>
toOption<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)."
https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.map_or.
and maybe add a little example like:
let x: Option<&str> = None;
assert_eq!(x.map(|s| s.len()), None);