about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Seiffert <matthias-seiffert@hotmail.de>2019-10-03 14:35:05 +0200
committerMatthias Seiffert <matthias-seiffert@hotmail.de>2019-10-03 14:35:05 +0200
commitfb25d5679949e26621f43cfbbd7f5864a60e2bd9 (patch)
tree6e9891dc87680334906aa17e02a376cca33d183e
parent320d17aa63f1516041beb9d42588dfd0bde90136 (diff)
downloadrust-fb25d5679949e26621f43cfbbd7f5864a60e2bd9.tar.gz
rust-fb25d5679949e26621f43cfbbd7f5864a60e2bd9.zip
Mention asserts in doc for unit_cmp lint
-rw-r--r--clippy_lints/src/types.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs
index a42a50e553a..2b3c02ce74e 100644
--- a/clippy_lints/src/types.rs
+++ b/clippy_lints/src/types.rs
@@ -487,7 +487,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetUnitValue {
 }
 
 declare_clippy_lint! {
-    /// **What it does:** Checks for comparisons to unit.
+    /// **What it does:** Checks for comparisons to unit. This includes all binary
+    /// comparisons (like `==` and `<`) and asserts.
     ///
     /// **Why is this bad?** Unit is always equal to itself, and thus is just a
     /// clumsily written constant. Mostly this happens when someone accidentally
@@ -519,6 +520,20 @@ declare_clippy_lint! {
     ///     baz();
     /// }
     /// ```
+    ///
+    /// For asserts:
+    /// ```rust
+    /// # fn foo() {};
+    /// # fn bar() {};
+    /// assert_eq!({ foo(); }, { bar(); });
+    /// ```
+    /// will always succeed
+    /// ```rust
+    /// # fn foo() {};
+    /// # fn bar() {};
+    /// assert_ne!({ foo(); }, { bar(); });
+    /// ```
+    /// will always fail
     pub UNIT_CMP,
     correctness,
     "comparing unit values"