about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDevin R <devin.ragotzy@gmail.com>2020-03-05 18:02:22 -0500
committerDevin R <devin.ragotzy@gmail.com>2020-04-20 06:30:00 -0400
commit139e2c6227506d7dc0be8ddff3cfd1fbe818a1a4 (patch)
treee4ba2350d18ff7e358a0f4085f482fcbe10bd868
parent001a42e632573abca10b2f8272f50a3999846e70 (diff)
downloadrust-139e2c6227506d7dc0be8ddff3cfd1fbe818a1a4.tar.gz
rust-139e2c6227506d7dc0be8ddff3cfd1fbe818a1a4.zip
creating suggestion
-rw-r--r--clippy_lints/src/if_let_mutex.rs2
-rwxr-xr-xif_let_mutexbin0 -> 2767320 bytes
-rwxr-xr-xredundant_pattern_matchingbin0 -> 2813024 bytes
-rw-r--r--tests/ui/redundant_pattern_matching.rs8
4 files changed, 9 insertions, 1 deletions
diff --git a/clippy_lints/src/if_let_mutex.rs b/clippy_lints/src/if_let_mutex.rs
index 34f0b22f65e..52e5b12c933 100644
--- a/clippy_lints/src/if_let_mutex.rs
+++ b/clippy_lints/src/if_let_mutex.rs
@@ -30,7 +30,7 @@ declare_clippy_lint! {
     /// ```
     pub IF_LET_MUTEX,
     correctness,
-    "locking a `Mutex` in an `if let` block can cause deadlock"
+    "locking a `Mutex` in an `if let` block can cause deadlocks"
 }
 
 declare_lint_pass!(IfLetMutex => [IF_LET_MUTEX]);
diff --git a/if_let_mutex b/if_let_mutex
new file mode 100755
index 00000000000..cbf56c047c0
--- /dev/null
+++ b/if_let_mutex
Binary files differdiff --git a/redundant_pattern_matching b/redundant_pattern_matching
new file mode 100755
index 00000000000..2b9462cdfc0
--- /dev/null
+++ b/redundant_pattern_matching
Binary files differdiff --git a/tests/ui/redundant_pattern_matching.rs b/tests/ui/redundant_pattern_matching.rs
index 9a9b3fb5ca0..a78a5e6ba19 100644
--- a/tests/ui/redundant_pattern_matching.rs
+++ b/tests/ui/redundant_pattern_matching.rs
@@ -85,6 +85,7 @@ fn main() {
 
     let _ = does_something();
     let _ = returns_unit();
+    let _ = issue_5271();
 
     let opt = Some(false);
     let x = if let Some(_) = opt { true } else { false };
@@ -112,3 +113,10 @@ fn returns_unit() {
         false
     };
 }
+
+fn issue_5271() {
+    let hello = Some(String::from("hello"));
+    let _x = match hello {
+        s @ _ => drop(s),
+    };
+}