mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
result_map_or_into_option: add good and bad examples
This commit is contained in:
parent
91759a7582
commit
3a29aedf8d
1 changed files with 7 additions and 2 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue