diff --git a/juniper/CHANGELOG.md b/juniper/CHANGELOG.md index f88db045..ad38683b 100644 --- a/juniper/CHANGELOG.md +++ b/juniper/CHANGELOG.md @@ -18,6 +18,7 @@ This should not have any impact on your code, since juniper already was 2018 com ### Other changes - The minimum required Rust version is now `1.34.0`. +- The `GraphQLType` impl for () was removed to improve compile time safefty. [#355](https://github.com/graphql-rust/juniper/pull/355) - The `ScalarValue` custom derive has been renamed to `GraphQLScalarValue`. - Added built-in support for the canonical schema introspection query via `juniper::introspect()`. diff --git a/juniper/src/types/scalars.rs b/juniper/src/types/scalars.rs index f6268509..6b969ce5 100644 --- a/juniper/src/types/scalars.rs +++ b/juniper/src/types/scalars.rs @@ -1,15 +1,14 @@ use std::convert::From; -use std::fmt::Debug; use std::marker::PhantomData; use std::ops::Deref; use std::{char, u32}; -use crate::ast::{FromInputValue, InputValue, Selection, ToInputValue}; +use crate::ast::{InputValue, Selection, ToInputValue}; use crate::executor::{Executor, Registry}; use crate::parser::{LexerError, ParseError, ScalarToken, Token}; use crate::schema::meta::MetaType; use crate::types::base::GraphQLType; -use crate::value::{ParseScalarResult, ParseScalarValue, ScalarRefValue, ScalarValue, Value}; +use crate::value::{ParseScalarResult, ScalarRefValue, ScalarValue, Value}; /// An ID as defined by the GraphQL specification /// @@ -274,46 +273,7 @@ graphql_scalar!(f64 as "Float" where Scalar = { } }); -impl GraphQLType for () -where - S: ScalarValue, - for<'b> &'b S: ScalarRefValue<'b>, -{ - type Context = (); - type TypeInfo = (); - - fn name(_: &()) -> Option<&str> { - Some("__Unit") - } - - fn meta<'r>(_: &(), registry: &mut Registry<'r, S>) -> MetaType<'r, S> - where - S: 'r, - for<'b> &'b S: ScalarRefValue<'b>, - { - registry.build_scalar_type::(&()).into_meta() - } -} - -impl ParseScalarValue for () -where - S: ScalarValue, -{ - fn from_str<'a>(_value: ScalarToken<'a>) -> ParseScalarResult<'a, S> { - Ok(S::from(0)) - } -} - -impl FromInputValue for () { - fn from_input_value<'a>(_: &'a InputValue) -> Option<()> - where - for<'b> &'b S: ScalarRefValue<'b>, - { - None - } -} - -/// Utility type to define read-only schemas +/// Utillity type to define read-only schemas /// /// If you instantiate `RootNode` with this as the mutation, no mutation will be /// generated for the schema.