@@ -14,16 +14,14 @@ where
1414 fn with_capacity ( capacity : usize ) -> Self ;
1515
1616 /// Updates a non-contiguous batch of leaves
17- fn update < ' a , I > ( & mut self , batch : I )
17+ fn update < I > ( & mut self , batch : I )
1818 where
19- I : IntoIterator < Item = & ' a ( usize , Value ) > ,
20- Value : ' a ;
19+ I : IntoIterator < Item = ( usize , Value ) > ;
2120
2221 /// Updates a contiguous batch of leaves
23- fn update_ordered < ' a , I > ( & mut self , values : I )
22+ fn update_ordered < I > ( & mut self , values : I )
2423 where
25- I : IntoIterator < Item = & ' a Value > ,
26- Value : ' a ;
24+ I : IntoIterator < Item = Value > ;
2725
2826 /// Aggregates all nodes in the FAT and returns the result
2927 fn aggregate ( & self ) -> Value ;
9290 fn new ( values : & [ Value ] ) -> Self {
9391 let capacity = values. len ( ) ;
9492 let mut new = Self :: with_capacity ( capacity) ;
95- new. update_ordered ( values) ;
93+ new. update_ordered ( values. iter ( ) . cloned ( ) ) ;
9694 new
9795 }
9896
@@ -105,16 +103,15 @@ where
105103 }
106104 }
107105
108- fn update < ' a , I > ( & mut self , batch : I )
106+ fn update < I > ( & mut self , batch : I )
109107 where
110- I : IntoIterator < Item = & ' a ( usize , Value ) > ,
111- Value : ' a ,
108+ I : IntoIterator < Item = ( usize , Value ) > ,
112109 {
113110 let mut parents: HashSet < usize > = batch
114111 . into_iter ( )
115112 . map ( |( idx, val) | {
116- let leaf = self . leaf ( * idx) ;
117- self . tree [ leaf] = val. clone ( ) ;
113+ let leaf = self . leaf ( idx) ;
114+ self . tree [ leaf] = val;
118115 self . parent ( leaf)
119116 } )
120117 . collect ( ) ;
@@ -136,14 +133,13 @@ where
136133 }
137134 }
138135
139- fn update_ordered < ' a , I > ( & mut self , values : I )
136+ fn update_ordered < I > ( & mut self , values : I )
140137 where
141- I : IntoIterator < Item = & ' a Value > ,
142- Value : ' a ,
138+ I : IntoIterator < Item = Value > ,
143139 {
144140 values. into_iter ( ) . enumerate ( ) . for_each ( |( idx, val) | {
145141 let leaf = self . leaf ( idx) ;
146- self . tree [ leaf] = val. clone ( ) ;
142+ self . tree [ leaf] = val;
147143 } ) ;
148144 ( 0 ..self . leaf ( 0 ) ) . into_iter ( ) . rev ( ) . for_each ( |parent| {
149145 let left = self . left ( parent) ;
0 commit comments