@@ -160,7 +160,7 @@ fn validate_commodities(
160160 for ( commodity, region_id, year) in iproduct ! (
161161 commodities. values( ) ,
162162 region_ids. iter( ) ,
163- milestone_years. iter( ) ,
163+ milestone_years. iter( ) . copied ( ) ,
164164 ) {
165165 match commodity. kind {
166166 CommodityType :: SupplyEqualsDemand => {
@@ -192,12 +192,12 @@ fn validate_sed_commodity(
192192 commodity_id : & CommodityID ,
193193 flows : & HashMap < ProcessID , ProcessFlowsMap > ,
194194 region_id : & RegionID ,
195- year : & u32 ,
195+ year : u32 ,
196196) -> Result < ( ) > {
197197 let mut has_producer = false ;
198198 let mut has_consumer = false ;
199199 for flows in flows. values ( ) {
200- let flows = flows. get ( & ( region_id. clone ( ) , * year) ) . unwrap ( ) ;
200+ let flows = flows. get ( & ( region_id. clone ( ) , year) ) . unwrap ( ) ;
201201 if let Some ( flow) = flows. get ( & commodity_id. clone ( ) ) {
202202 if flow. coeff > 0.0 {
203203 has_producer = true ;
@@ -223,14 +223,14 @@ fn validate_svd_commodity(
223223 flows : & HashMap < ProcessID , ProcessFlowsMap > ,
224224 availabilities : & HashMap < ProcessID , ProcessActivityLimitsMap > ,
225225 region_id : & RegionID ,
226- year : & u32 ,
226+ year : u32 ,
227227 ts_selection : & TimeSliceSelection ,
228228) -> Result < ( ) > {
229229 // Check if the commodity has a demand in the given time slice, region and year.
230230 // We only need to check for producers if there is positive demand.
231231 let demand = * commodity
232232 . demand
233- . get ( & ( region_id. clone ( ) , * year, ts_selection. clone ( ) ) )
233+ . get ( & ( region_id. clone ( ) , year, ts_selection. clone ( ) ) )
234234 . unwrap ( ) ;
235235 if demand <= 0.0 {
236236 return Ok ( ( ) ) ;
@@ -239,7 +239,7 @@ fn validate_svd_commodity(
239239 // We must check for producers in the given year, region and time slices.
240240 // This includes checking if flow > 0 and if availability > 0.
241241 for ( process_id, flows) in flows. iter ( ) {
242- let flows = flows. get ( & ( region_id. clone ( ) , * year) ) . unwrap ( ) ;
242+ let flows = flows. get ( & ( region_id. clone ( ) , year) ) . unwrap ( ) ;
243243 let Some ( flow) = flows. get ( & commodity. id ) else {
244244 // We're only interested in processes which produce this commodity
245245 continue ;
@@ -253,7 +253,7 @@ fn validate_svd_commodity(
253253 let availabilities = availabilities. get ( process_id) . unwrap ( ) ;
254254 for ( ts, _) in ts_selection. iter ( time_slice_info) {
255255 let availability = availabilities
256- . get ( & ( region_id. clone ( ) , * year, ts. clone ( ) ) )
256+ . get ( & ( region_id. clone ( ) , year, ts. clone ( ) ) )
257257 . unwrap ( ) ;
258258 if * availability. end ( ) > 0.0 {
259259 return Ok ( ( ) ) ;
@@ -330,7 +330,7 @@ mod tests {
330330 ( "process1" . into( ) , input_flows_sed. clone( ) ) ,
331331 ( "process2" . into( ) , output_flows_sed. clone( ) ) ,
332332 ] ) ;
333- assert ! ( validate_sed_commodity( & commodity_sed. id, & flows, & "GBR" . into( ) , & 2010 ) . is_ok( ) ) ;
333+ assert ! ( validate_sed_commodity( & commodity_sed. id, & flows, & "GBR" . into( ) , 2010 ) . is_ok( ) ) ;
334334 }
335335
336336 #[ rstest]
@@ -340,14 +340,14 @@ mod tests {
340340 ) {
341341 // Invalid scenario: no producer
342342 let flows = HashMap :: from_iter ( vec ! [ ( "process1" . into( ) , input_flows_sed. clone( ) ) ] ) ;
343- assert ! ( validate_sed_commodity( & commodity_sed. id, & flows, & "GBR" . into( ) , & 2010 ) . is_err( ) ) ;
343+ assert ! ( validate_sed_commodity( & commodity_sed. id, & flows, & "GBR" . into( ) , 2010 ) . is_err( ) ) ;
344344 }
345345
346346 #[ rstest]
347347 fn test_validate_sed_commodity ( commodity_sed : Commodity , output_flows_sed : ProcessFlowsMap ) {
348348 // Invalid scenario: no consumer
349349 let flows = HashMap :: from_iter ( vec ! [ ( "process2" . into( ) , output_flows_sed. clone( ) ) ] ) ;
350- assert ! ( validate_sed_commodity( & commodity_sed. id, & flows, & "GBR" . into( ) , & 2010 ) . is_err( ) ) ;
350+ assert ! ( validate_sed_commodity( & commodity_sed. id, & flows, & "GBR" . into( ) , 2010 ) . is_err( ) ) ;
351351 }
352352
353353 #[ fixture]
@@ -402,7 +402,7 @@ mod tests {
402402 & flows_svd,
403403 & availabilities,
404404 & "GBR" . into( ) ,
405- & 2010 ,
405+ 2010 ,
406406 & time_slice. into( )
407407 )
408408 . is_ok( ) ) ;
@@ -429,7 +429,7 @@ mod tests {
429429 & flows_svd,
430430 & availabilities,
431431 & "GBR" . into( ) ,
432- & 2010 ,
432+ 2010 ,
433433 & time_slice. into( )
434434 )
435435 . is_err( ) ) ;
0 commit comments