Skip to content

Commit

Permalink
result_map_or_into_option: add good and bad examples
Browse files Browse the repository at this point in the history
  • Loading branch information
nickrtorres committed Apr 4, 2020
1 parent 91759a7 commit 3a29aed
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions clippy_lints/src/methods/mod.rs
Expand Up @@ -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,
Expand Down

0 comments on commit 3a29aed

Please sign in to comment.