-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Improve Option::inspect
docs
#120815
Improve Option::inspect
docs
#120815
Conversation
library/core/src/option.rs
Outdated
/// Calls `f` with a reference to the contained value if [`Some`] and | ||
/// returns the original Option. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This first sentence appears on its own in some contexts (at least in search results), without the signature with the argument name "f". So, it might be better not to refer to f
here by name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I was looking at the docs for Option::and_then which uses f
, but I see most other methods use "a function". Changed to that.
Also I broke the "returns" statement into a separate paragraph.
8a10015
to
e9059cb
Compare
@rustbot review |
Thanks! @bors r+ rollup |
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#120351 (Implement SystemTime for UEFI) - rust-lang#120354 (improve normalization of `Pointee::Metadata`) - rust-lang#120776 (Move path implementations into `sys`) - rust-lang#120790 (better error message on download CI LLVM failure) - rust-lang#120806 (Clippy subtree update) - rust-lang#120815 (Improve `Option::inspect` docs) - rust-lang#120822 (Emit more specific diagnostics when enums fail to cast with `as`) - rust-lang#120827 (Print image input file and checksum in CI only) - rust-lang#120836 (hide impls if trait bound is proven from env) - rust-lang#120844 (Build DebugInfo for async closures) - rust-lang#120851 (Remove duplicate release note) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#120351 (Implement SystemTime for UEFI) - rust-lang#120354 (improve normalization of `Pointee::Metadata`) - rust-lang#120776 (Move path implementations into `sys`) - rust-lang#120790 (better error message on download CI LLVM failure) - rust-lang#120806 (Clippy subtree update) - rust-lang#120815 (Improve `Option::inspect` docs) - rust-lang#120822 (Emit more specific diagnostics when enums fail to cast with `as`) - rust-lang#120827 (Print image input file and checksum in CI only) - rust-lang#120836 (hide impls if trait bound is proven from env) - rust-lang#120844 (Build DebugInfo for async closures) - rust-lang#120851 (Remove duplicate release note) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#120815 - camsteffen:inspect-docs, r=m-ou-se Improve `Option::inspect` docs * Refer to the function as "a function" instead of "the provided closure" since it is not necessarily a closure. * State that the original Option/Result is returned. * Adjust the example for `Option::inspect` to use chaining.
Option::inspect
to use chaining.