Skip to content

Commit d712d7f

Browse files
committed
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.
1 parent 8d6cf3a commit d712d7f

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

0 commit comments

Comments
 (0)