Rollup merge of #102259 - gimbles:patch-1, r=joshtriplett

Type-annotate and simplify documentation of Option::unwrap_or_default

Part of #100054
This commit is contained in:
fee1-dead 2022-09-25 22:06:41 +08:00 committed by GitHub
commit c50303ca1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -842,6 +842,7 @@ impl<T> Option<T> {
/// ```
/// let good_year_from_input = "1909";
/// let bad_year_from_input = "190blarg";
/// // Result::ok() converts a Result<T> to an Option<T>
/// let good_year = good_year_from_input.parse().ok().unwrap_or_default();
/// let bad_year = bad_year_from_input.parse().ok().unwrap_or_default();
///