-
Notifications
You must be signed in to change notification settings - Fork 14k
Add examples to Option::map_or documentation #135551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add examples to Option::map_or documentation #135551
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
This comment has been minimized.
This comment has been minimized.
0d58cf2 to
307a6d4
Compare
This comment has been minimized.
This comment has been minimized.
|
I do not believe that any of these cases add anything of value compared to the two existing examples above. They are just more verbose, but showcase no new features or behavior. |
307a6d4 to
d12312d
Compare
This comment has been minimized.
This comment has been minimized.
|
There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged. You can start a rebase with the following commands: The following commits are merge commits: |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
This PR enhances the documentation of the
Option::map_ormethod by adding more comprehensive and practical examples. These updates aim to help developers better understand the method's behavior and usage in various scenarios, especially when dealing withSomeandNonecases.Changes Made:
Added Examples for Clarity:
map_orapplies a function to a value whenSomeis present.Noneis encountered.Introduced a Real-World Use Case:
map_orcan be used to handle fallback logic, such as generating personalized greeting messages.Improved Readability:
Updated Examples:
Benefits:
map_oreffectively.If there are additional scenarios or edge cases worth including, I'm happy to expand this PR!