@@ -12,12 +12,6 @@ use tokio::sync::{mpsc, oneshot};
1212pub trait Reset : Default {
1313 /// Reset the state to its default value.
1414 fn reset ( & mut self ) ;
15-
16- /// A ref count to ensure that the state is unique when shutting down.
17- ///
18- /// You are not allowed to clone the state out of a task, even though that
19- /// is possible.
20- fn ref_count ( & self ) -> usize ;
2115}
2216
2317#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
@@ -219,7 +213,6 @@ mod entity_actor {
219213 )
220214 . await
221215 . ok ( ) ;
222- assert_eq ! ( self . state. state. ref_count( ) , 1 ) ;
223216 P :: on_shutdown ( self . state . clone ( ) , ShutdownCause :: Idle ) . await ;
224217 // Notify the main actor that we have completed shutdown.
225218 // here we also give back the rest of ourselves so the main actor can recycle us.
@@ -846,10 +839,6 @@ mod tests {
846839 fn reset ( & mut self ) {
847840 * self . 0 . borrow_mut ( ) = Default :: default ( ) ;
848841 }
849-
850- fn ref_count ( & self ) -> usize {
851- Arc :: strong_count ( & self . 0 )
852- }
853842 }
854843
855844 #[ derive( Debug , Default ) ]
@@ -971,8 +960,9 @@ mod tests {
971960 for id in values. keys ( ) {
972961 let log = global. log . get ( id) . unwrap ( ) ;
973962 if log. len ( ) % 2 != 0 {
974- println ! ( "{log:#?}" ) ;
975- panic ! ( "Log for entity {id} must contain an even number of events" ) ;
963+ panic ! (
964+ "Log for entity {id} must contain an even number of events.\n {log:#?}"
965+ ) ;
976966 }
977967 for ( i, ( event, _) ) in log. iter ( ) . enumerate ( ) {
978968 assert_eq ! (
@@ -1106,10 +1096,6 @@ mod tests {
11061096 fn reset ( & mut self ) {
11071097 * self . 0 . borrow_mut ( ) = Default :: default ( ) ;
11081098 }
1109-
1110- fn ref_count ( & self ) -> usize {
1111- 1
1112- }
11131099 }
11141100
11151101 fn get_path ( root : impl AsRef < Path > , id : u64 ) -> PathBuf {
0 commit comments