File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -15,18 +15,25 @@ declare_clippy_lint! {
1515 ///
1616 /// ### Example
1717 /// ```rust
18+ /// # let fallback = "fallback";
1819 /// // Result
20+ /// # type Error = &'static str;
21+ /// # let result: Result<&str, Error> = Err("error");
1922 /// let port = result.or::<Error>(Ok(fallback)).unwrap();
2023 ///
2124 /// // Option
25+ /// # let option: Option<&str> = None;
2226 /// let value = option.or(Some(fallback)).unwrap();
2327 /// ```
2428 /// Use instead:
2529 /// ```rust
30+ /// # let fallback = "fallback";
2631 /// // Result
32+ /// # let result: Result<&str, &str> = Err("error");
2733 /// let port = result.unwrap_or(fallback);
2834 ///
2935 /// // Option
36+ /// # let option: Option<&str> = None;
3037 /// let value = option.unwrap_or(fallback);
3138 /// ```
3239 #[ clippy:: version = "1.61.0" ]
You can’t perform that action at this time.
0 commit comments