Skip to content

Commit 99374ae

Browse files
committed
Auto merge of rust-lang#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`
2 parents fd42ab4 + 36a8648 commit 99374ae

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clippy_lints/src/mut_key.rs

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

0 commit comments

Comments
 (0)