Auto merge of #6019 - rail-rain:improve_known_probs_mut_key, r=flip1995

Improve the "known problems" section of `interior_mutable_key`

* Remove the mention to `Rc` and `Arc` as these are `Freeze` (despite my intuition) so the lint correctly handles already.
* Instead, explain what could cause a false positive, and mention `bytes` as an example.

---

changelog: Improved the "known problems" section of `interior_mutable_key`
This commit is contained in:
bors 2020-09-10 15:17:09 +00:00
commit 99374ae136

View file

@ -12,8 +12,10 @@ declare_clippy_lint! {
/// `BtreeSet` rely on either the hash or the order of keys be unchanging,
/// so having types with interior mutability is a bad idea.
///
/// **Known problems:** We don't currently account for `Rc` or `Arc`, so
/// this may yield false positives.
/// **Known problems:** It's correct to use a struct, that contains interior mutability
/// as a key, when its `Hash` implementation doesn't access any of the interior mutable types.
/// However, this lint is unable to recognize this, so it causes a false positive in theses cases.
/// The `bytes` crate is a great example of this.
///
/// **Example:**
/// ```rust