@@ -16,7 +16,7 @@ use tokio::time::{Timeout, timeout};
1616
1717pub trait EventDescriptor {
1818 #[ cfg( feature = "hanging_detection" ) ]
19- fn get_description ( & self ) -> Arc < dyn Fn ( ) -> String + Sync + Send > ;
19+ fn get_description ( self ) -> Arc < dyn Fn ( ) -> String + Sync + Send > ;
2020}
2121
2222impl < T , InnerFn > EventDescriptor for T
2525 InnerFn : Fn ( ) -> String + Sync + Send + ' static ,
2626{
2727 #[ cfg( feature = "hanging_detection" ) ]
28- fn get_description ( & self ) -> Arc < dyn Fn ( ) -> String + Sync + Send > {
29- ( self ) ( )
28+ fn get_description ( self ) -> Arc < dyn Fn ( ) -> String + Sync + Send > {
29+ Arc :: new ( ( self ) ( ) )
3030 }
3131}
3232
@@ -38,14 +38,14 @@ pub struct EventDescription {
3838
3939impl EventDescription {
4040 #[ inline( always) ]
41- pub fn new < InnerFn > ( _description : impl FnOnce ( ) -> InnerFn ) -> Self
41+ pub fn new < InnerFn > ( # [ allow ( unused_variables ) ] description : impl FnOnce ( ) -> InnerFn ) -> Self
4242 where
4343 InnerFn : Fn ( ) -> String + Sync + Send + ' static ,
4444 {
45- return Self {
45+ Self {
4646 #[ cfg( feature = "hanging_detection" ) ]
4747 description : Arc :: new ( ( description) ( ) ) ,
48- } ;
48+ }
4949 }
5050}
5151
@@ -61,8 +61,8 @@ impl Display for EventDescription {
6161
6262impl EventDescriptor for EventDescription {
6363 #[ cfg( feature = "hanging_detection" ) ]
64- fn get_description ( & self ) -> Arc < dyn Fn ( ) -> String + Sync + Send > {
65- self . description . clone ( )
64+ fn get_description ( self ) -> Arc < dyn Fn ( ) -> String + Sync + Send > {
65+ self . description
6666 }
6767}
6868
@@ -87,14 +87,14 @@ impl Event {
8787 /// The outer closure allows avoiding extra lookups (e.g. task type info) that may be needed to
8888 /// capture information needed for constructing (moving into) the inner closure.
8989 #[ inline( always) ]
90- pub fn new ( _description : impl EventDescriptor ) -> Self {
90+ pub fn new ( # [ allow ( unused_variables ) ] description : impl EventDescriptor ) -> Self {
9191 #[ cfg( not( feature = "hanging_detection" ) ) ]
9292 return Self {
9393 event : event_listener:: Event :: new ( ) ,
9494 } ;
9595 #[ cfg( feature = "hanging_detection" ) ]
9696 return Self {
97- description : _description . get_description ( ) ,
97+ description : description . get_description ( ) ,
9898 event : event_listener:: Event :: new ( ) ,
9999 } ;
100100 }
0 commit comments