result_map_or_into_option: add good and bad examples

This commit is contained in:
Nick Torres 2020-04-04 13:44:11 -07:00
parent 91759a7582
commit 3a29aedf8d

View file

@ -340,8 +340,13 @@ declare_clippy_lint! {
///
/// **Example:**
/// ```rust
/// # let opt = Some(1);
/// # let r = opt.map_or(None, Some);
/// # Bad
/// let r: Result<u32, &str> = Ok(1);
/// assert_eq!(Some(1), r.map_or(None, Some));
///
/// # Good
/// let r: Result<u32, &str> = Ok(1);
/// assert_eq!(Some(1), r.ok());
/// ```
pub RESULT_MAP_OR_INTO_OPTION,
style,