From e6a836e2e801a3c0675b3dd24e0de1c810470813 Mon Sep 17 00:00:00 2001
From: flip1995 <hello@philkrones.com>
Date: Tue, 30 Jul 2019 09:50:56 +0200
Subject: [PATCH 1/3] Move UNNECESSARY_UNWRAP to complexity and
 PANICKING_UNWRAP to correctness

---
 clippy_lints/src/lib.rs    | 6 ++++--
 clippy_lints/src/unwrap.rs | 4 ++--
 src/lintlist/mod.rs        | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs
index 908bbeb5e19..1e9e17f599c 100644
--- a/clippy_lints/src/lib.rs
+++ b/clippy_lints/src/lib.rs
@@ -894,6 +894,8 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
         unused_io_amount::UNUSED_IO_AMOUNT,
         unused_label::UNUSED_LABEL,
+        unwrap::PANICKING_UNWRAP,
+        unwrap::UNNECESSARY_UNWRAP,
         vec::USELESS_VEC,
         write::PRINTLN_EMPTY_STRING,
         write::PRINT_LITERAL,
@@ -1060,6 +1062,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         types::UNNECESSARY_CAST,
         types::VEC_BOX,
         unused_label::UNUSED_LABEL,
+        unwrap::UNNECESSARY_UNWRAP,
         zero_div_zero::ZERO_DIVIDED_BY_ZERO,
     ]);
 
@@ -1121,6 +1124,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         types::UNIT_CMP,
         unicode::ZERO_WIDTH_SPACE,
         unused_io_amount::UNUSED_IO_AMOUNT,
+        unwrap::PANICKING_UNWRAP,
     ]);
 
     reg.register_lint_group("clippy::perf", Some("clippy_perf"), vec![
@@ -1157,8 +1161,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry<'_>, conf: &Conf) {
         needless_borrow::NEEDLESS_BORROW,
         path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE,
         redundant_clone::REDUNDANT_CLONE,
-        unwrap::PANICKING_UNWRAP,
-        unwrap::UNNECESSARY_UNWRAP,
     ]);
 }
 
diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs
index 568087b3667..830e1fc4d25 100644
--- a/clippy_lints/src/unwrap.rs
+++ b/clippy_lints/src/unwrap.rs
@@ -31,7 +31,7 @@ declare_clippy_lint! {
     /// }
     /// ```
     pub UNNECESSARY_UNWRAP,
-    nursery,
+    complexity,
     "checks for calls of unwrap[_err]() that cannot fail"
 }
 
@@ -52,7 +52,7 @@ declare_clippy_lint! {
     ///
     /// This code will always panic. The if condition should probably be inverted.
     pub PANICKING_UNWRAP,
-    nursery,
+    correctness,
     "checks for calls of unwrap[_err]() that will always fail"
 }
 
diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs
index 49bce5a6cef..aa457664020 100644
--- a/src/lintlist/mod.rs
+++ b/src/lintlist/mod.rs
@@ -1381,7 +1381,7 @@ pub const ALL_LINTS: [Lint; 309] = [
     },
     Lint {
         name: "panicking_unwrap",
-        group: "nursery",
+        group: "correctness",
         desc: "checks for calls of unwrap[_err]() that will always fail",
         deprecation: None,
         module: "unwrap",
@@ -1927,7 +1927,7 @@ pub const ALL_LINTS: [Lint; 309] = [
     },
     Lint {
         name: "unnecessary_unwrap",
-        group: "nursery",
+        group: "complexity",
         desc: "checks for calls of unwrap[_err]() that cannot fail",
         deprecation: None,
         module: "unwrap",

From 7a73b8fdfaa6bec11d9326d0a2077f6cf6d238a7 Mon Sep 17 00:00:00 2001
From: flip1995 <hello@philkrones.com>
Date: Tue, 30 Jul 2019 09:51:45 +0200
Subject: [PATCH 2/3] Remove Known problems for UNNECESSARY_UNWRAP

This shouldn't happen with NLL
---
 clippy_lints/src/unwrap.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs
index 830e1fc4d25..c2fb62c3017 100644
--- a/clippy_lints/src/unwrap.rs
+++ b/clippy_lints/src/unwrap.rs
@@ -14,7 +14,7 @@ declare_clippy_lint! {
     ///
     /// **Why is this bad?** Using `if let` or `match` is more idiomatic.
     ///
-    /// **Known problems:** Limitations of the borrow checker might make unwrap() necessary sometimes?
+    /// **Known problems:** None
     ///
     /// **Example:**
     /// ```rust

From feca48d8a292c66186fb391c231327b85e116cd9 Mon Sep 17 00:00:00 2001
From: flip1995 <hello@philkrones.com>
Date: Thu, 1 Aug 2019 12:53:20 +0200
Subject: [PATCH 3/3] Fix doc tests

---
 clippy_lints/src/unwrap.rs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs
index c2fb62c3017..d39c341d06e 100644
--- a/clippy_lints/src/unwrap.rs
+++ b/clippy_lints/src/unwrap.rs
@@ -18,6 +18,8 @@ declare_clippy_lint! {
     ///
     /// **Example:**
     /// ```rust
+    /// # let option = Some(0);
+    /// # fn do_something_with(_x: usize) {}
     /// if option.is_some() {
     ///     do_something_with(option.unwrap())
     /// }
@@ -26,6 +28,8 @@ declare_clippy_lint! {
     /// Could be written:
     ///
     /// ```rust
+    /// # let option = Some(0);
+    /// # fn do_something_with(_x: usize) {}
     /// if let Some(value) = option {
     ///     do_something_with(value)
     /// }
@@ -45,6 +49,8 @@ declare_clippy_lint! {
     ///
     /// **Example:**
     /// ```rust
+    /// # let option = Some(0);
+    /// # fn do_something_with(_x: usize) {}
     /// if option.is_none() {
     ///     do_something_with(option.unwrap())
     /// }