File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -482,9 +482,10 @@ impl PartialEq for InstrumentationScope {
482482 self . name == other. name
483483 && self . version == other. version
484484 && self . schema_url == other. schema_url
485+ && self . attributes . len ( ) == other. attributes . len ( )
485486 && {
486- let mut self_attrs = self . attributes . clone ( ) ;
487- let mut other_attrs = other. attributes . clone ( ) ;
487+ let mut self_attrs = Vec :: from_iter ( & self . attributes ) ;
488+ let mut other_attrs = Vec :: from_iter ( & other. attributes ) ;
488489 self_attrs. sort_unstable_by ( |a, b| a. key . cmp ( & b. key ) ) ;
489490 other_attrs. sort_unstable_by ( |a, b| a. key . cmp ( & b. key ) ) ;
490491 self_attrs == other_attrs
@@ -499,7 +500,7 @@ impl hash::Hash for InstrumentationScope {
499500 self . name . hash ( state) ;
500501 self . version . hash ( state) ;
501502 self . schema_url . hash ( state) ;
502- let mut sorted_attrs = self . attributes . clone ( ) ;
503+ let mut sorted_attrs = Vec :: from_iter ( & self . attributes ) ;
503504 sorted_attrs. sort_unstable_by ( |a, b| a. key . cmp ( & b. key ) ) ;
504505 for attribute in sorted_attrs {
505506 attribute. hash ( state) ;
Original file line number Diff line number Diff line change @@ -77,9 +77,7 @@ impl TextMapCompositePropagator {
7777 pub fn new ( propagators : Vec < Box < dyn TextMapPropagator + Send + Sync > > ) -> Self {
7878 let mut fields = HashSet :: new ( ) ;
7979 for propagator in & propagators {
80- for field in propagator. fields ( ) {
81- fields. insert ( field. to_string ( ) ) ;
82- }
80+ fields. extend ( propagator. fields ( ) . map ( ToString :: to_string) ) ;
8381 }
8482
8583 TextMapCompositePropagator {
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ impl TraceState {
134134 return Err ( TraceStateError :: Value ( value) ) ;
135135 }
136136
137- let mut trace_state = self . delete_from_deque ( key. clone ( ) ) ;
137+ let mut trace_state = self . delete_from_deque ( & key) ;
138138 let kvs = trace_state. 0 . get_or_insert ( VecDeque :: with_capacity ( 1 ) ) ;
139139
140140 kvs. push_front ( ( key, value) ) ;
@@ -155,14 +155,14 @@ impl TraceState {
155155 return Err ( TraceStateError :: Key ( key) ) ;
156156 }
157157
158- Ok ( self . delete_from_deque ( key) )
158+ Ok ( self . delete_from_deque ( & key) )
159159 }
160160
161161 /// Delete key from trace state's deque. The key MUST be valid
162- fn delete_from_deque ( & self , key : String ) -> TraceState {
162+ fn delete_from_deque ( & self , key : & str ) -> TraceState {
163163 let mut owned = self . clone ( ) ;
164164 if let Some ( kvs) = owned. 0 . as_mut ( ) {
165- if let Some ( index) = kvs. iter ( ) . position ( |x| * x. 0 == * key) {
165+ if let Some ( index) = kvs. iter ( ) . position ( |x| x. 0 == key) {
166166 kvs. remove ( index) ;
167167 }
168168 }
You can’t perform that action at this time.
0 commit comments