diff --git a/src/map.rs b/src/map.rs index 1217945a34..8ef2977c3a 100644 --- a/src/map.rs +++ b/src/map.rs @@ -2556,9 +2556,12 @@ impl<'a, K, V, S, A: AllocRef + Clone> Entry<'a, K, V, S, A> { } } - /// Ensures a value is in the entry by inserting, if empty, the result of the default function, - /// which takes the key as its argument, and returns a mutable reference to the value in the - /// entry. + /// Ensures a value is in the entry by inserting, if empty, the result of the default function. + /// This method allows for generating key-derived values for insertion by providing the default + /// function a reference to the key that was moved during the `.entry(key)` method call. + /// + /// The reference to the moved key is provided so that cloning or copying the key is + /// unnecessary, unlike with `.or_insert_with(|| ... )`. /// /// # Examples ///