Skip to content

Commit

Permalink
Auto merge of #6019 - rail-rain:improve_known_probs_mut_key, r=flip1995
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
bors committed Sep 10, 2020
2 parents fd42ab4 + 36a8648 commit 99374ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clippy_lints/src/mut_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 99374ae

Please sign in to comment.