File tree Expand file tree Collapse file tree 1 file changed +10
-16
lines changed
Expand file tree Collapse file tree 1 file changed +10
-16
lines changed Original file line number Diff line number Diff line change @@ -388,25 +388,19 @@ fn build_child_filter_from_object(
388388/// Parses a list of GraphQL values into a vector of entity field values.
389389fn list_values ( value : Value , filter_type : & str ) -> Result < Vec < Value > , QueryExecutionError > {
390390 match value {
391- Value :: List ( ref values) if !values . is_empty ( ) => {
391+ Value :: List ( values) => {
392392 // Check that all values in list are of the same type
393393 let root_discriminant = discriminant ( & values[ 0 ] ) ;
394- values
395- . iter ( )
396- . map ( |value| {
397- let current_discriminant = discriminant ( value) ;
398- if root_discriminant == current_discriminant {
399- Ok ( value. clone ( ) )
400- } else {
401- Err ( QueryExecutionError :: ListTypesError (
402- filter_type. to_string ( ) ,
403- vec ! [ values[ 0 ] . to_string( ) , value. to_string( ) ] ,
404- ) )
405- }
406- } )
407- . collect :: < Result < Vec < _ > , _ > > ( )
394+ for value in & values {
395+ if root_discriminant != discriminant ( value) {
396+ return Err ( QueryExecutionError :: ListTypesError (
397+ filter_type. to_string ( ) ,
398+ vec ! [ values[ 0 ] . to_string( ) , value. to_string( ) ] ,
399+ ) ) ;
400+ }
401+ }
402+ Ok ( values)
408403 }
409- Value :: List ( ref values) if values. is_empty ( ) => Ok ( vec ! [ ] ) ,
410404 _ => Err ( QueryExecutionError :: ListFilterError (
411405 filter_type. to_string ( ) ,
412406 ) ) ,
You can’t perform that action at this time.
0 commit comments