@@ -30,13 +30,13 @@ pub fn get_date_range_value(time_dimensions: Option<&Vec<QueryTimeDimension>>) -
3030 None => bail ! ( "QueryTimeDimension should be specified for the compare date range query." ) ,
3131 } ;
3232
33- let dim = match time_dimensions. get ( 0 ) {
33+ let dim = match time_dimensions. first ( ) {
3434 Some ( dim) => dim,
3535 None => bail ! ( "No time dimension provided." ) ,
3636 } ;
3737
3838 let date_range: & Vec < String > = match & dim. date_range {
39- Some ( date_range) => date_range. as_ref ( ) ,
39+ Some ( date_range) => date_range,
4040 None => bail ! ( "Inconsistent QueryTimeDimension configuration: dateRange required." ) ,
4141 } ;
4242
@@ -165,7 +165,7 @@ pub fn get_compact_row(
165165 query_type : & QueryType ,
166166 members : & [ String ] ,
167167 time_dimensions : Option < & Vec < QueryTimeDimension > > ,
168- db_row : & Vec < String > ,
168+ db_row : & [ String ] ,
169169 columns_pos : & HashMap < String , usize > ,
170170) -> Result < Vec < String > > {
171171 let mut row: Vec < String > = Vec :: with_capacity ( members. len ( ) ) ;
@@ -213,7 +213,7 @@ pub fn get_vanilla_row(
213213 annotation : & HashMap < String , ConfigItem > ,
214214 query_type : & QueryType ,
215215 query : & NormalizedQuery ,
216- db_row : & Vec < String > ,
216+ db_row : & [ String ] ,
217217 columns_pos : & HashMap < String , usize > ,
218218) -> Result < HashMap < String , String > > {
219219 let mut row = HashMap :: new ( ) ;
@@ -293,7 +293,7 @@ pub fn transform_data(
293293 let members_to_alias_map = get_members (
294294 query_type,
295295 query,
296- & data,
296+ data,
297297 alias_to_member_name_map,
298298 annotation,
299299 ) ?;
@@ -311,7 +311,7 @@ pub fn transform_data(
311311 query_type,
312312 & members,
313313 query. time_dimensions . as_ref ( ) ,
314- & row,
314+ row,
315315 & data. columns_pos ,
316316 )
317317 } )
@@ -328,7 +328,7 @@ pub fn transform_data(
328328 annotation,
329329 query_type,
330330 query,
331- & row,
331+ row,
332332 & data. columns_pos ,
333333 )
334334 } )
@@ -339,14 +339,14 @@ pub fn transform_data(
339339}
340340
341341/// Helper to get a list if unique granularities from normalized queries
342- pub fn get_query_granularities ( queries : & Vec < & NormalizedQuery > ) -> Vec < String > {
342+ pub fn get_query_granularities ( queries : & [ & NormalizedQuery ] ) -> Vec < String > {
343343 queries
344344 . iter ( )
345345 . filter_map ( |query| {
346346 query
347347 . time_dimensions
348348 . as_ref ( )
349- . and_then ( |tds| tds. get ( 0 ) )
349+ . and_then ( |tds| tds. first ( ) )
350350 . and_then ( |td| td. granularity . clone ( ) )
351351 } )
352352 . collect :: < HashSet < _ > > ( )
@@ -361,7 +361,7 @@ pub fn get_pivot_query(
361361) -> Result < NormalizedQuery > {
362362 let mut pivot_query = queries
363363 . first ( )
364- . map ( |q| * q )
364+ . copied ( )
365365 . cloned ( )
366366 . ok_or_else ( || anyhow:: anyhow!( "Queries list cannot be empty" ) ) ?;
367367
@@ -392,7 +392,7 @@ pub fn get_pivot_query(
392392 dimension: "time" . to_string( ) ,
393393 date_range: None ,
394394 compare_date_range: None ,
395- granularity: granularities. get ( 0 ) . cloned( ) ,
395+ granularity: granularities. first ( ) . cloned( ) ,
396396 } ] ) ;
397397 }
398398 }
@@ -427,7 +427,7 @@ pub fn get_final_cubestore_result(
427427 annotation,
428428 cube_store_result,
429429 query,
430- & query_type,
430+ query_type,
431431 res_type. clone ( ) ,
432432 ) ?;
433433
@@ -437,16 +437,16 @@ pub fn get_final_cubestore_result(
437437}
438438
439439pub fn get_final_cubestore_result_multi (
440- request_data : & Vec < TransformDataRequest > ,
441- cube_store_result : & Vec < & CubeStoreResult > ,
440+ request_data : & [ TransformDataRequest ] ,
441+ cube_store_result : & [ & CubeStoreResult ] ,
442442 result_data : & mut RequestResultDataMulti ,
443443) -> Result < ( ) > {
444444 for ( transform_data, cube_store_result, result) in multizip ( (
445445 request_data. iter ( ) ,
446446 cube_store_result. iter ( ) ,
447447 result_data. results . iter_mut ( ) ,
448448 ) ) {
449- get_final_cubestore_result ( transform_data, * cube_store_result, result) ?;
449+ get_final_cubestore_result ( transform_data, cube_store_result, result) ?;
450450 }
451451
452452 let normalized_queries = result_data
0 commit comments