Make Clippy happy for 1.67 Rust
This commit is contained in:
parent
9e0b9692a9
commit
150227f357
24 changed files with 66 additions and 81 deletions
|
@ -567,8 +567,8 @@ impl<'a, S> Arguments<'a, S> {
|
||||||
pub fn get(&self, key: &str) -> Option<&Spanning<InputValue<S>>> {
|
pub fn get(&self, key: &str) -> Option<&Spanning<InputValue<S>>> {
|
||||||
self.items
|
self.items
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|&&(ref k, _)| k.item == key)
|
.filter(|&(k, _)| k.item == key)
|
||||||
.map(|&(_, ref v)| v)
|
.map(|(_, v)| v)
|
||||||
.next()
|
.next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ where
|
||||||
),
|
),
|
||||||
InputValue::Object(ref o) => LookAheadValue::Object(
|
InputValue::Object(ref o) => LookAheadValue::Object(
|
||||||
o.iter()
|
o.iter()
|
||||||
.map(|&(ref n, ref i)| {
|
.map(|(n, i)| {
|
||||||
(
|
(
|
||||||
&n.item as &str,
|
&n.item as &str,
|
||||||
LookAheadValue::from_input_value(&i.item, vars),
|
LookAheadValue::from_input_value(&i.item, vars),
|
||||||
|
@ -76,7 +76,7 @@ where
|
||||||
S: ScalarValue,
|
S: ScalarValue,
|
||||||
{
|
{
|
||||||
pub(super) fn new(
|
pub(super) fn new(
|
||||||
&(ref name, ref value): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
(name, value): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
||||||
vars: &'a Variables<S>,
|
vars: &'a Variables<S>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
LookAheadArgument {
|
LookAheadArgument {
|
||||||
|
@ -143,12 +143,12 @@ where
|
||||||
let d = &d.item;
|
let d = &d.item;
|
||||||
let arguments = &d.arguments;
|
let arguments = &d.arguments;
|
||||||
match (d.name.item, arguments) {
|
match (d.name.item, arguments) {
|
||||||
("include", &Some(ref a)) => a
|
("include", Some(a)) => a
|
||||||
.item
|
.item
|
||||||
.items
|
.items
|
||||||
.iter()
|
.iter()
|
||||||
.find(|item| item.0.item == "if")
|
.find(|item| item.0.item == "if")
|
||||||
.map(|&(_, ref v)| {
|
.map(|(_, v)| {
|
||||||
if let LookAheadValue::Scalar(s) =
|
if let LookAheadValue::Scalar(s) =
|
||||||
LookAheadValue::from_input_value(&v.item, vars)
|
LookAheadValue::from_input_value(&v.item, vars)
|
||||||
{
|
{
|
||||||
|
@ -158,12 +158,12 @@ where
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or(false),
|
.unwrap_or(false),
|
||||||
("skip", &Some(ref a)) => a
|
("skip", Some(a)) => a
|
||||||
.item
|
.item
|
||||||
.items
|
.items
|
||||||
.iter()
|
.iter()
|
||||||
.find(|item| item.0.item == "if")
|
.find(|item| item.0.item == "if")
|
||||||
.map(|&(_, ref v)| {
|
.map(|(_, v)| {
|
||||||
if let LookAheadValue::Scalar(b) =
|
if let LookAheadValue::Scalar(b) =
|
||||||
LookAheadValue::from_input_value(&v.item, vars)
|
LookAheadValue::from_input_value(&v.item, vars)
|
||||||
{
|
{
|
||||||
|
|
|
@ -940,7 +940,7 @@ where
|
||||||
defs.item
|
defs.item
|
||||||
.items
|
.items
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|&(ref name, ref def)| {
|
.filter_map(|(name, def)| {
|
||||||
def.default_value
|
def.default_value
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|i| (name.item.into(), i.item.clone()))
|
.map(|i| (name.item.into(), i.item.clone()))
|
||||||
|
@ -1087,7 +1087,7 @@ where
|
||||||
defs.item
|
defs.item
|
||||||
.items
|
.items
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|&(ref name, ref def)| {
|
.filter_map(|(name, def)| {
|
||||||
def.default_value
|
def.default_value
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|i| (name.item.into(), i.item.clone()))
|
.map(|i| (name.item.into(), i.item.clone()))
|
||||||
|
|
|
@ -268,8 +268,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Execute the reference introspection query in the provided schema
|
/// Execute the reference introspection query in the provided schema
|
||||||
pub fn introspect<'a, S, QueryT, MutationT, SubscriptionT>(
|
pub fn introspect<S, QueryT, MutationT, SubscriptionT>(
|
||||||
root_node: &'a RootNode<QueryT, MutationT, SubscriptionT, S>,
|
root_node: &RootNode<QueryT, MutationT, SubscriptionT, S>,
|
||||||
context: &QueryT::Context,
|
context: &QueryT::Context,
|
||||||
format: IntrospectionFormat,
|
format: IntrospectionFormat,
|
||||||
) -> Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError>
|
) -> Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError>
|
||||||
|
|
|
@ -38,7 +38,7 @@ where
|
||||||
item: Token::CurlyOpen,
|
item: Token::CurlyOpen,
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
Some(&MetaType::InputObject(ref o)),
|
Some(MetaType::InputObject(o)),
|
||||||
) => parse_object_literal(parser, is_const, schema, Some(o)),
|
) => parse_object_literal(parser, is_const, schema, Some(o)),
|
||||||
(
|
(
|
||||||
&Spanning {
|
&Spanning {
|
||||||
|
@ -52,7 +52,7 @@ where
|
||||||
item: Token::Scalar(_),
|
item: Token::Scalar(_),
|
||||||
..
|
..
|
||||||
},
|
},
|
||||||
Some(&MetaType::Scalar(ref s)),
|
Some(MetaType::Scalar(s)),
|
||||||
) => {
|
) => {
|
||||||
if let Spanning {
|
if let Spanning {
|
||||||
item: Token::Scalar(scalar),
|
item: Token::Scalar(scalar),
|
||||||
|
@ -210,7 +210,7 @@ where
|
||||||
{
|
{
|
||||||
let result = match token {
|
let result = match token {
|
||||||
ScalarToken::String(_) => {
|
ScalarToken::String(_) => {
|
||||||
if let Some(&MetaType::Scalar(ref s)) = schema.concrete_type_by_name("String") {
|
if let Some(MetaType::Scalar(s)) = schema.concrete_type_by_name("String") {
|
||||||
(s.parse_fn)(token).map(InputValue::Scalar)
|
(s.parse_fn)(token).map(InputValue::Scalar)
|
||||||
} else {
|
} else {
|
||||||
Err(ParseError::ExpectedScalarError(
|
Err(ParseError::ExpectedScalarError(
|
||||||
|
@ -219,7 +219,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScalarToken::Int(_) => {
|
ScalarToken::Int(_) => {
|
||||||
if let Some(&MetaType::Scalar(ref s)) = schema.concrete_type_by_name("Int") {
|
if let Some(MetaType::Scalar(s)) = schema.concrete_type_by_name("Int") {
|
||||||
(s.parse_fn)(token).map(InputValue::Scalar)
|
(s.parse_fn)(token).map(InputValue::Scalar)
|
||||||
} else {
|
} else {
|
||||||
Err(ParseError::ExpectedScalarError(
|
Err(ParseError::ExpectedScalarError(
|
||||||
|
@ -228,7 +228,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScalarToken::Float(_) => {
|
ScalarToken::Float(_) => {
|
||||||
if let Some(&MetaType::Scalar(ref s)) = schema.concrete_type_by_name("Float") {
|
if let Some(MetaType::Scalar(s)) = schema.concrete_type_by_name("Float") {
|
||||||
(s.parse_fn)(token).map(InputValue::Scalar)
|
(s.parse_fn)(token).map(InputValue::Scalar)
|
||||||
} else {
|
} else {
|
||||||
Err(ParseError::ExpectedScalarError(
|
Err(ParseError::ExpectedScalarError(
|
||||||
|
|
|
@ -244,7 +244,7 @@ where
|
||||||
f.arguments.as_ref().map(|m| {
|
f.arguments.as_ref().map(|m| {
|
||||||
m.item
|
m.item
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|&(ref k, ref v)| {
|
.filter_map(|(k, v)| {
|
||||||
v.item.clone().into_const(exec_vars).map(|v| (k.item, v))
|
v.item.clone().into_const(exec_vars).map(|v| (k.item, v))
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
|
|
@ -472,7 +472,7 @@ where
|
||||||
f.arguments.as_ref().map(|m| {
|
f.arguments.as_ref().map(|m| {
|
||||||
m.item
|
m.item
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|&(ref k, ref v)| {
|
.filter_map(|(k, v)| {
|
||||||
v.item.clone().into_const(exec_vars).map(|v| (k.item, v))
|
v.item.clone().into_const(exec_vars).map(|v| (k.item, v))
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
@ -596,10 +596,9 @@ pub(super) fn is_excluded<S>(
|
||||||
where
|
where
|
||||||
S: ScalarValue,
|
S: ScalarValue,
|
||||||
{
|
{
|
||||||
if let Some(ref directives) = *directives {
|
if let Some(directives) = directives {
|
||||||
for &Spanning {
|
for Spanning {
|
||||||
item: ref directive,
|
item: directive, ..
|
||||||
..
|
|
||||||
} in directives
|
} in directives
|
||||||
{
|
{
|
||||||
let condition: bool = directive
|
let condition: bool = directive
|
||||||
|
|
|
@ -316,7 +316,7 @@ where
|
||||||
f.arguments.as_ref().map(|m| {
|
f.arguments.as_ref().map(|m| {
|
||||||
m.item
|
m.item
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|&(ref k, ref v)| {
|
.filter_map(|(k, v)| {
|
||||||
v.item.clone().into_const(exec_vars).map(|v| (k.item, v))
|
v.item.clone().into_const(exec_vars).map(|v| (k.item, v))
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
|
|
@ -80,7 +80,7 @@ where
|
||||||
})
|
})
|
||||||
.collect::<HashSet<_>>();
|
.collect::<HashSet<_>>();
|
||||||
|
|
||||||
let all_types_ok = obj.iter().all(|&(ref key, ref value)| {
|
let all_types_ok = obj.iter().all(|(key, value)| {
|
||||||
remaining_required_fields.remove(&key.item);
|
remaining_required_fields.remove(&key.item);
|
||||||
if let Some(ref arg_type) = input_fields
|
if let Some(ref arg_type) = input_fields
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -173,7 +173,7 @@ impl<'a, S: Debug> ValidatorContext<'a, S> {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn current_type_literal(&self) -> Option<&Type<'a>> {
|
pub fn current_type_literal(&self) -> Option<&Type<'a>> {
|
||||||
match self.type_literal_stack.last() {
|
match self.type_literal_stack.last() {
|
||||||
Some(&Some(ref t)) => Some(t),
|
Some(Some(t)) => Some(t),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ impl<'a, S: Debug> ValidatorContext<'a, S> {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn current_input_type_literal(&self) -> Option<&Type<'a>> {
|
pub fn current_input_type_literal(&self) -> Option<&Type<'a>> {
|
||||||
match self.input_type_literal_stack.last() {
|
match self.input_type_literal_stack.last() {
|
||||||
Some(&Some(ref t)) => Some(t),
|
Some(Some(t)) => Some(t),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ fn validate_var_defs<S>(
|
||||||
) where
|
) where
|
||||||
S: ScalarValue,
|
S: ScalarValue,
|
||||||
{
|
{
|
||||||
for &(ref name, ref def) in var_defs.iter() {
|
for (name, def) in var_defs.iter() {
|
||||||
let raw_type_name = def.var_type.item.innermost_name();
|
let raw_type_name = def.var_type.item.innermost_name();
|
||||||
match schema.concrete_type_by_name(raw_type_name) {
|
match schema.concrete_type_by_name(raw_type_name) {
|
||||||
Some(t) if t.is_input() => {
|
Some(t) if t.is_input() => {
|
||||||
|
@ -188,12 +188,12 @@ where
|
||||||
errors
|
errors
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unify_scalar<'a, S>(
|
fn unify_scalar<S>(
|
||||||
var_name: &str,
|
var_name: &str,
|
||||||
var_pos: &SourcePosition,
|
var_pos: &SourcePosition,
|
||||||
value: &InputValue<S>,
|
value: &InputValue<S>,
|
||||||
meta: &ScalarMeta<S>,
|
meta: &ScalarMeta<S>,
|
||||||
path: &Path<'a>,
|
path: &Path<'_>,
|
||||||
) -> Vec<RuleError>
|
) -> Vec<RuleError>
|
||||||
where
|
where
|
||||||
S: ScalarValue,
|
S: ScalarValue,
|
||||||
|
@ -231,12 +231,12 @@ where
|
||||||
errors
|
errors
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unify_enum<'a, S>(
|
fn unify_enum<S>(
|
||||||
var_name: &str,
|
var_name: &str,
|
||||||
var_pos: &SourcePosition,
|
var_pos: &SourcePosition,
|
||||||
value: &InputValue<S>,
|
value: &InputValue<S>,
|
||||||
meta: &EnumMeta<S>,
|
meta: &EnumMeta<S>,
|
||||||
path: &Path<'a>,
|
path: &Path<'_>,
|
||||||
) -> Vec<RuleError>
|
) -> Vec<RuleError>
|
||||||
where
|
where
|
||||||
S: ScalarValue,
|
S: ScalarValue,
|
||||||
|
@ -277,13 +277,13 @@ where
|
||||||
errors
|
errors
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unify_input_object<'a, S>(
|
fn unify_input_object<S>(
|
||||||
var_name: &str,
|
var_name: &str,
|
||||||
var_pos: &SourcePosition,
|
var_pos: &SourcePosition,
|
||||||
value: &InputValue<S>,
|
value: &InputValue<S>,
|
||||||
meta: &InputObjectMeta<S>,
|
meta: &InputObjectMeta<S>,
|
||||||
schema: &SchemaType<S>,
|
schema: &SchemaType<S>,
|
||||||
path: &Path<'a>,
|
path: &Path<'_>,
|
||||||
) -> Vec<RuleError>
|
) -> Vec<RuleError>
|
||||||
where
|
where
|
||||||
S: ScalarValue,
|
S: ScalarValue,
|
||||||
|
|
|
@ -50,7 +50,7 @@ where
|
||||||
fn enter_argument(
|
fn enter_argument(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'a, S>,
|
||||||
&(ref arg_name, ref arg_value): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
(arg_name, arg_value): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
||||||
) {
|
) {
|
||||||
if let Some(argument_meta) = self
|
if let Some(argument_meta) = self
|
||||||
.current_args
|
.current_args
|
||||||
|
|
|
@ -21,7 +21,7 @@ where
|
||||||
fn enter_variable_definition(
|
fn enter_variable_definition(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'a, S>,
|
||||||
&(ref var_name, ref var_def): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
(var_name, var_def): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
||||||
) {
|
) {
|
||||||
if let Some(Spanning {
|
if let Some(Spanning {
|
||||||
item: ref var_value,
|
item: ref var_value,
|
||||||
|
|
|
@ -71,7 +71,7 @@ where
|
||||||
fn enter_argument(
|
fn enter_argument(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'a, S>,
|
||||||
&(ref arg_name, _): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
(arg_name, _): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
||||||
) {
|
) {
|
||||||
if let Some((ref pos, args)) = self.current_args {
|
if let Some((ref pos, args)) = self.current_args {
|
||||||
if !args.iter().any(|a| a.name == arg_name.item) {
|
if !args.iter().any(|a| a.name == arg_name.item) {
|
||||||
|
|
|
@ -38,15 +38,15 @@ where
|
||||||
fn enter_variable_definition(
|
fn enter_variable_definition(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'a, S>,
|
||||||
&(_, ref var_def): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
(_, var_def): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
||||||
) {
|
) {
|
||||||
let type_name = var_def.var_type.item.innermost_name();
|
let type_name = var_def.var_type.item.innermost_name();
|
||||||
validate_type(ctx, type_name, &var_def.var_type.start);
|
validate_type(ctx, type_name, &var_def.var_type.start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_type<'a, S: Debug>(
|
fn validate_type<S: Debug>(
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'_, S>,
|
||||||
type_name: &str,
|
type_name: &str,
|
||||||
location: &SourcePosition,
|
location: &SourcePosition,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -85,7 +85,7 @@ where
|
||||||
S: ScalarValue,
|
S: ScalarValue,
|
||||||
{
|
{
|
||||||
fn exit_document(&mut self, ctx: &mut ValidatorContext<'a, S>, _: &'a Document<S>) {
|
fn exit_document(&mut self, ctx: &mut ValidatorContext<'a, S>, _: &'a Document<S>) {
|
||||||
for (op_name, &(ref pos, ref def_vars)) in &self.defined_variables {
|
for (op_name, (pos, def_vars)) in &self.defined_variables {
|
||||||
let mut unused = Vec::new();
|
let mut unused = Vec::new();
|
||||||
let mut visited = HashSet::new();
|
let mut visited = HashSet::new();
|
||||||
self.find_undef_vars(
|
self.find_undef_vars(
|
||||||
|
@ -141,7 +141,7 @@ where
|
||||||
fn enter_variable_definition(
|
fn enter_variable_definition(
|
||||||
&mut self,
|
&mut self,
|
||||||
_: &mut ValidatorContext<'a, S>,
|
_: &mut ValidatorContext<'a, S>,
|
||||||
&(ref var_name, _): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
(var_name, _): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
||||||
) {
|
) {
|
||||||
if let Some(Scope::Operation(ref name)) = self.current_scope {
|
if let Some(Scope::Operation(ref name)) = self.current_scope {
|
||||||
if let Some(&mut (_, ref mut vars)) = self.defined_variables.get_mut(name) {
|
if let Some(&mut (_, ref mut vars)) = self.defined_variables.get_mut(name) {
|
||||||
|
@ -153,7 +153,7 @@ where
|
||||||
fn enter_argument(
|
fn enter_argument(
|
||||||
&mut self,
|
&mut self,
|
||||||
_: &mut ValidatorContext<'a, S>,
|
_: &mut ValidatorContext<'a, S>,
|
||||||
&(_, ref value): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
(_, value): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
||||||
) {
|
) {
|
||||||
if let Some(ref scope) = self.current_scope {
|
if let Some(ref scope) = self.current_scope {
|
||||||
self.used_variables
|
self.used_variables
|
||||||
|
|
|
@ -139,7 +139,7 @@ where
|
||||||
fn enter_variable_definition(
|
fn enter_variable_definition(
|
||||||
&mut self,
|
&mut self,
|
||||||
_: &mut ValidatorContext<'a, S>,
|
_: &mut ValidatorContext<'a, S>,
|
||||||
&(ref var_name, _): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
(var_name, _): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
||||||
) {
|
) {
|
||||||
if let Some(Scope::Operation(ref name)) = self.current_scope {
|
if let Some(Scope::Operation(ref name)) = self.current_scope {
|
||||||
if let Some(vars) = self.defined_variables.get_mut(name) {
|
if let Some(vars) = self.defined_variables.get_mut(name) {
|
||||||
|
@ -151,7 +151,7 @@ where
|
||||||
fn enter_argument(
|
fn enter_argument(
|
||||||
&mut self,
|
&mut self,
|
||||||
_: &mut ValidatorContext<'a, S>,
|
_: &mut ValidatorContext<'a, S>,
|
||||||
&(_, ref value): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
(_, value): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
||||||
) {
|
) {
|
||||||
if let Some(ref scope) = self.current_scope {
|
if let Some(ref scope) = self.current_scope {
|
||||||
self.used_variables
|
self.used_variables
|
||||||
|
|
|
@ -447,8 +447,7 @@ impl<'a, S: Debug> OverlappingFieldsCanBeMerged<'a, S> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let (&Some(ref s1), &Some(ref s2)) = (&ast1.item.selection_set, &ast2.item.selection_set)
|
if let (Some(s1), Some(s2)) = (&ast1.item.selection_set, &ast2.item.selection_set) {
|
||||||
{
|
|
||||||
let conflicts = self.find_conflicts_between_sub_selection_sets(
|
let conflicts = self.find_conflicts_between_sub_selection_sets(
|
||||||
mutually_exclusive,
|
mutually_exclusive,
|
||||||
t1.map(Type::innermost_name),
|
t1.map(Type::innermost_name),
|
||||||
|
@ -547,19 +546,11 @@ impl<'a, S: Debug> OverlappingFieldsCanBeMerged<'a, S> {
|
||||||
),
|
),
|
||||||
vec![*pos1]
|
vec![*pos1]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(
|
.chain(conflicts.iter().flat_map(|Conflict(_, fs1, _)| fs1.clone()))
|
||||||
conflicts
|
|
||||||
.iter()
|
|
||||||
.flat_map(|&Conflict(_, ref fs1, _)| fs1.clone()),
|
|
||||||
)
|
|
||||||
.collect(),
|
.collect(),
|
||||||
vec![*pos2]
|
vec![*pos2]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.chain(
|
.chain(conflicts.iter().flat_map(|Conflict(_, _, fs2)| fs2.clone()))
|
||||||
conflicts
|
|
||||||
.iter()
|
|
||||||
.flat_map(|&Conflict(_, _, ref fs2)| fs2.clone()),
|
|
||||||
)
|
|
||||||
.collect(),
|
.collect(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -615,10 +606,8 @@ impl<'a, S: Debug> OverlappingFieldsCanBeMerged<'a, S> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
args1.iter().all(|&(ref n1, ref v1)| {
|
args1.iter().all(|(n1, v1)| {
|
||||||
if let Some(&(_, ref v2)) =
|
if let Some((_, v2)) = args2.iter().find(|&(n2, _)| n1.item == n2.item) {
|
||||||
args2.iter().find(|&&(ref n2, _)| n1.item == n2.item)
|
|
||||||
{
|
|
||||||
v1.item.unlocated_eq(&v2.item)
|
v1.item.unlocated_eq(&v2.item)
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
@ -756,11 +745,11 @@ fn error_message(reason_name: &str, reason: &ConflictReasonMessage) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_reason(reason: &ConflictReasonMessage) -> String {
|
fn format_reason(reason: &ConflictReasonMessage) -> String {
|
||||||
match *reason {
|
match reason {
|
||||||
ConflictReasonMessage::Message(ref name) => name.clone(),
|
ConflictReasonMessage::Message(name) => name.clone(),
|
||||||
ConflictReasonMessage::Nested(ref nested) => nested
|
ConflictReasonMessage::Nested(nested) => nested
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&ConflictReason(ref name, ref subreason)| {
|
.map(|ConflictReason(name, subreason)| {
|
||||||
format!(
|
format!(
|
||||||
r#"subfields "{name}" conflict because {}"#,
|
r#"subfields "{name}" conflict because {}"#,
|
||||||
format_reason(subreason),
|
format_reason(subreason),
|
||||||
|
|
|
@ -52,8 +52,8 @@ where
|
||||||
) {
|
) {
|
||||||
let directive_name = &directive.item.name.item;
|
let directive_name = &directive.item.name.item;
|
||||||
|
|
||||||
if let Some(&DirectiveType {
|
if let Some(DirectiveType {
|
||||||
arguments: ref meta_args,
|
arguments: meta_args,
|
||||||
..
|
..
|
||||||
}) = ctx.schema.directive_by_name(directive_name)
|
}) = ctx.schema.directive_by_name(directive_name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ where
|
||||||
fn enter_argument(
|
fn enter_argument(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'a, S>,
|
||||||
&(ref arg_name, _): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
(arg_name, _): &'a (Spanning<&'a str>, Spanning<InputValue<S>>),
|
||||||
) {
|
) {
|
||||||
match self.known_names.entry(arg_name.item) {
|
match self.known_names.entry(arg_name.item) {
|
||||||
Entry::Occupied(e) => {
|
Entry::Occupied(e) => {
|
||||||
|
|
|
@ -32,7 +32,7 @@ where
|
||||||
fn enter_object_field(
|
fn enter_object_field(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'a, S>,
|
||||||
&(ref field_name, _): &'a (Spanning<String>, Spanning<InputValue<S>>),
|
(field_name, _): &'a (Spanning<String>, Spanning<InputValue<S>>),
|
||||||
) {
|
) {
|
||||||
if let Some(ref mut known_names) = self.known_name_stack.last_mut() {
|
if let Some(ref mut known_names) = self.known_name_stack.last_mut() {
|
||||||
match known_names.entry(&field_name.item) {
|
match known_names.entry(&field_name.item) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ where
|
||||||
fn enter_variable_definition(
|
fn enter_variable_definition(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'a, S>,
|
||||||
&(ref var_name, _): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
(var_name, _): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
||||||
) {
|
) {
|
||||||
match self.names.entry(var_name.item) {
|
match self.names.entry(var_name.item) {
|
||||||
Entry::Occupied(e) => {
|
Entry::Occupied(e) => {
|
||||||
|
|
|
@ -20,7 +20,7 @@ where
|
||||||
fn enter_variable_definition(
|
fn enter_variable_definition(
|
||||||
&mut self,
|
&mut self,
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'a, S>,
|
||||||
&(ref var_name, ref var_def): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
(var_name, var_def): &'a (Spanning<&'a str>, VariableDefinition<S>),
|
||||||
) {
|
) {
|
||||||
if let Some(var_type) = ctx
|
if let Some(var_type) = ctx
|
||||||
.schema
|
.schema
|
||||||
|
|
|
@ -79,18 +79,15 @@ impl<'a, S: fmt::Debug> VariableInAllowedPosition<'a, S> {
|
||||||
visited.insert(from.clone());
|
visited.insert(from.clone());
|
||||||
|
|
||||||
if let Some(usages) = self.variable_usages.get(from) {
|
if let Some(usages) = self.variable_usages.get(from) {
|
||||||
for &(ref var_name, ref var_type) in usages {
|
for (var_name, var_type) in usages {
|
||||||
if let Some(&&(ref var_def_name, ref var_def)) = var_defs
|
if let Some(&(var_def_name, var_def)) =
|
||||||
.iter()
|
var_defs.iter().find(|&&(n, _)| n.item == var_name.item)
|
||||||
.find(|&&&(ref n, _)| n.item == var_name.item)
|
|
||||||
{
|
{
|
||||||
let expected_type = match (&var_def.default_value, &var_def.var_type.item) {
|
let expected_type = match (&var_def.default_value, &var_def.var_type.item) {
|
||||||
(&Some(_), &Type::List(ref inner, expected_size)) => {
|
(&Some(_), Type::List(inner, expected_size)) => {
|
||||||
Type::NonNullList(inner.clone(), expected_size)
|
Type::NonNullList(inner.clone(), *expected_size)
|
||||||
}
|
|
||||||
(&Some(_), &Type::Named(ref inner)) => {
|
|
||||||
Type::NonNullNamed(Cow::Borrowed(inner))
|
|
||||||
}
|
}
|
||||||
|
(&Some(_), Type::Named(inner)) => Type::NonNullNamed(Cow::Borrowed(inner)),
|
||||||
(_, t) => t.clone(),
|
(_, t) => t.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -165,7 +162,7 @@ where
|
||||||
ctx: &mut ValidatorContext<'a, S>,
|
ctx: &mut ValidatorContext<'a, S>,
|
||||||
var_name: Spanning<&'a String>,
|
var_name: Spanning<&'a String>,
|
||||||
) {
|
) {
|
||||||
if let (&Some(ref scope), Some(input_type)) =
|
if let (Some(scope), Some(input_type)) =
|
||||||
(&self.current_scope, ctx.current_input_type_literal())
|
(&self.current_scope, ctx.current_input_type_literal())
|
||||||
{
|
{
|
||||||
self.variable_usages
|
self.variable_usages
|
||||||
|
|
Loading…
Reference in a new issue