diff options
| author | Nick Torres <nickrtorres@icloud.com> | 2020-04-04 13:44:11 -0700 |
|---|---|---|
| committer | Nick Torres <nickrtorres@icloud.com> | 2020-04-04 14:16:18 -0700 |
| commit | 3a29aedf8db3af19ee0f64dee6f00489812e6cb0 (patch) | |
| tree | 81f3ce94d6d69408e62d7772a1da03c2229950a8 | |
| parent | 91759a7582a292c3f85204b1d61e7185c8543959 (diff) | |
| download | rust-3a29aedf8db3af19ee0f64dee6f00489812e6cb0.tar.gz rust-3a29aedf8db3af19ee0f64dee6f00489812e6cb0.zip | |
result_map_or_into_option: add good and bad examples
| -rw-r--r-- | clippy_lints/src/methods/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 37bb3710fab..7c818232a55 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -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, |
