Improve "known problems" of interior_mutable_key

* Remove the mention to `Rc` and `Arc` as these are `Freeze`
  so the lint correctly handles already.

* Instead, explain what could cause a false positive,
  and mention `bytes` as an example.
This commit is contained in:
rail 2020-09-09 14:18:19 +12:00
parent 8d6cf3a824
commit d712d7f700

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 these interior mutable types.
/// However, this lint is unable to recognise it so cause a false positive.
/// `bytes` ctate is a great example of this.
///
/// **Example:**
/// ```rust