Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanmylee committed Dec 19, 2023
1 parent b67a875 commit dc12425
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/parser_util.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::graphql::*;
use crate::gson;
use graphql_parser::Pos;
use graphql_parser::query::*;
use graphql_parser::Pos;
use std::collections::HashMap;

pub fn alias_or_name<'a, T>(query_field: &graphql_parser::query::Field<'a, T>) -> String
Expand Down Expand Up @@ -55,10 +55,8 @@ where

field.position = field.position.min(matching_field.position);

field.selection_set.span = min_encapsulating_span(
field.selection_set.span,
matching_field.selection_set.span,
);
field.selection_set.span =
min_encapsulating_span(field.selection_set.span, matching_field.selection_set.span);

// Subfields will be normalized and properly merged on a later pass.
field
Expand Down Expand Up @@ -102,7 +100,7 @@ where
&_field_a.type_,
&_field_b.type_,
)?;

if field_a.name != field_b.name {
return Err(format!(
"Fields '{}' conflict because '{}' and '{}' are different fields",
Expand All @@ -111,14 +109,15 @@ where
field_b.name.as_ref(),
));
}

for (arg_a_name, arg_a_value) in field_a.arguments.iter() {
let arg_b_value = field_b.arguments.iter().find_map(|(name, value)|
let arg_b_value = field_b.arguments.iter().find_map(|(name, value)| {
if name == arg_a_name {
Some(value)
} else {
None
});
}
});
let args_match = match arg_b_value {
None => false,
Some(arg_b_value) => arg_b_value == arg_a_value,
Expand All @@ -130,7 +129,7 @@ where
));
}
}

Ok(())
}

Expand Down Expand Up @@ -185,7 +184,7 @@ pub fn has_same_type_shape(
))
};
}

// TODO handle composite types?

// Subfield type shapes will be checked on a later pass.
Expand Down

0 comments on commit dc12425

Please sign in to comment.