@@ -98,9 +98,12 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> Entry<'a, K, V, S> {
9898 ///
9999 /// If you are not interested in the occupied entry,
100100 /// consider [`insert`] as it doesn't need to clone the key.
101- ///
101+ ///
102102 /// [`insert`]: Entry::insert
103- pub fn insert_entry ( self , value : V ) -> OccupiedEntry < ' a , K , V , S > where K : Clone {
103+ pub fn insert_entry ( self , value : V ) -> OccupiedEntry < ' a , K , V , S >
104+ where
105+ K : Clone ,
106+ {
104107 match self {
105108 Entry :: Occupied ( mut entry) => {
106109 entry. insert ( value) ;
@@ -145,7 +148,10 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> VacantEntry<'a, K, V, S> {
145148 }
146149
147150 /// Sets the value of the entry with the VacantEntry’s key, and returns an OccupiedEntry.
148- pub fn insert_entry ( mut self , value : V ) -> OccupiedEntry < ' a , K , V , S > where K : Clone {
151+ pub fn insert_entry ( mut self , value : V ) -> OccupiedEntry < ' a , K , V , S >
152+ where
153+ K : Clone ,
154+ {
149155 unsafe {
150156 self . shard . insert ( self . key . clone ( ) , SharedValue :: new ( value) ) ;
151157
@@ -230,8 +236,6 @@ impl<'a, K: Eq + Hash, V, S: BuildHasher> OccupiedEntry<'a, K, V, S> {
230236 }
231237}
232238
233-
234-
235239#[ cfg( test) ]
236240mod tests {
237241 use crate :: DashMap ;
@@ -245,7 +249,7 @@ mod tests {
245249 let entry = map. entry ( 1 ) ;
246250
247251 assert ! ( matches!( entry, Entry :: Vacant ( _) ) ) ;
248-
252+
249253 let entry = entry. insert_entry ( 2 ) ;
250254
251255 assert_eq ! ( * entry. get( ) , 2 ) ;
@@ -264,7 +268,7 @@ mod tests {
264268 let entry = map. entry ( 1 ) ;
265269
266270 assert ! ( matches!( & entry, Entry :: Occupied ( entry) if * entry. get( ) == 1000 ) ) ;
267-
271+
268272 let entry = entry. insert_entry ( 2 ) ;
269273
270274 assert_eq ! ( * entry. get( ) , 2 ) ;
@@ -273,4 +277,4 @@ mod tests {
273277
274278 assert_eq ! ( * map. get( & 1 ) . unwrap( ) , 2 ) ;
275279 }
276- }
280+ }
0 commit comments