Formatting...

This commit is contained in:
Christoph Herzog 2019-05-07 11:23:46 +02:00
parent 3cc142bfbc
commit de12e0eba5
No known key found for this signature in database
GPG key ID: DAFF71D48B493238
6 changed files with 40 additions and 48 deletions

View file

@ -109,21 +109,14 @@ extern crate uuid;
// This allows users to just depend on juniper and get the derive
// functionality automatically.
pub use juniper_codegen::{
GraphQLEnum,
GraphQLInputObject,
GraphQLObject,
GraphQLScalarValue,
ScalarValue,
impl_object,
impl_object, GraphQLEnum, GraphQLInputObject, GraphQLObject, GraphQLScalarValue, ScalarValue,
};
// Internal macros are not exported,
// but declared at the root to make them easier to use.
#[allow(unused_imports)]
use juniper_codegen::{
impl_object_internal, GraphQLEnumInternal, GraphQLInputObjectInternal,
GraphQLScalarValueInternal,
GraphQLEnumInternal,
GraphQLInputObjectInternal,
impl_object_internal,
};
#[macro_use]

View file

@ -146,15 +146,13 @@ where
fn fields(&self, include_deprecated: bool) -> Option<Vec<&Field<S>>> {
match *self {
TypeType::Concrete(&MetaType::Interface(InterfaceMeta { ref fields, .. }))
| TypeType::Concrete(&MetaType::Object(ObjectMeta { ref fields, .. })) => {
Some(
| TypeType::Concrete(&MetaType::Object(ObjectMeta { ref fields, .. })) => Some(
fields
.iter()
.filter(|f| include_deprecated || !f.deprecation_status.is_deprecated())
.filter(|f| !f.name.starts_with("__"))
.collect(),
)
}
),
_ => None,
}
}
@ -233,14 +231,12 @@ where
#[graphql(arguments(include_deprecated(default = false)))]
fn enum_values(&self, include_deprecated: bool) -> Option<Vec<&EnumValue>> {
match *self {
TypeType::Concrete(&MetaType::Enum(EnumMeta { ref values, .. })) => {
Some(
TypeType::Concrete(&MetaType::Enum(EnumMeta { ref values, .. })) => Some(
values
.iter()
.filter(|f| include_deprecated || !f.deprecation_status.is_deprecated())
.collect(),
)
}
),
_ => None,
}
}

View file

@ -163,13 +163,16 @@ pub fn build_impl_object(args: TokenStream, body: TokenStream, is_internal: bool
}
// Make sure the user does not specify the Context
// without a reference. (&Context)
else if context_type.clone().map(|ctx| ctx == &captured.ty).unwrap_or(false) {
else if context_type
.clone()
.map(|ctx| ctx == &captured.ty)
.unwrap_or(false)
{
panic!(
"Invalid context argument: to access the context, you need to specify the type as a reference.\nDid you mean &{}?",
quote!(captured.ty),
);
}
else {
} else {
let ty = &captured.ty;
// TODO: respect graphql attribute overwrite.
let final_name = util::to_camel_case(&arg_name);

View file

@ -764,9 +764,9 @@ impl GraphQLTypeDefiniton {
// Insert a where clause that marks the scalar as
// compatible with ScalarValueRef.
// Same as in branch above.
where_clause.predicates.push(
parse_quote!(for<'__b> &'__b __S: #juniper_crate_name::ScalarRefValue<'__b>),
);
where_clause
.predicates
.push(parse_quote!(for<'__b> &'__b __S: #juniper_crate_name::ScalarRefValue<'__b>));
}
let type_generics_tokens = if self.include_type_generics {