Clippy clean

This commit is contained in:
Sunli 2021-01-11 09:01:28 +08:00
parent 78a1ea1910
commit 5f2e0ae50d
9 changed files with 19 additions and 9 deletions

View File

@ -148,7 +148,9 @@ impl<T: OutputType + Send + Sync + ?Sized> OutputType for Box<T> {
#[async_trait::async_trait]
impl<T: InputType + Send + Sync> InputType for Box<T> {
fn parse(value: Option<ConstValue>) -> InputValueResult<Self> {
T::parse(value).map(Box::new).map_err(InputValueError::map)
T::parse(value)
.map(Box::new)
.map_err(InputValueError::propagate)
}
fn to_value(&self) -> ConstValue {
@ -181,7 +183,9 @@ impl<T: OutputType + Send + Sync + ?Sized> OutputType for Arc<T> {
#[async_trait::async_trait]
impl<T: InputType + Send + Sync> InputType for Arc<T> {
fn parse(value: Option<ConstValue>) -> InputValueResult<Self> {
T::parse(value).map(Arc::new).map_err(InputValueError::map)
T::parse(value)
.map(Arc::new)
.map_err(InputValueError::propagate)
}
fn to_value(&self) -> ConstValue {

View File

@ -125,13 +125,6 @@ impl<T: InputType> InputValueError<T> {
}
}
pub(crate) fn map<Q>(self) -> InputValueError<Q> {
InputValueError {
message: self.message,
phantom: PhantomData,
}
}
/// The expected input type did not match the actual input type.
#[must_use]
pub fn expected_type(actual: Value) -> Self {

View File

@ -104,6 +104,7 @@ mod tests {
struct MyObj;
#[Object(internal)]
#[allow(unreachable_code)]
impl MyObj {
async fn a(&self) -> i32 {
todo!()
@ -119,6 +120,7 @@ mod tests {
}
#[Object(internal)]
#[allow(unreachable_code)]
impl Query {
async fn value(&self) -> i32 {
todo!()

View File

@ -43,6 +43,7 @@ mod tests {
struct MyObj;
#[Object(internal)]
#[allow(unreachable_code)]
impl MyObj {
async fn a(&self) -> i32 {
todo!()
@ -58,6 +59,7 @@ mod tests {
}
#[Object(internal)]
#[allow(unreachable_code)]
impl Query {
async fn value(&self) -> i32 {
todo!()

View File

@ -124,6 +124,7 @@ struct Query;
/// Global query
#[Object]
#[allow(unreachable_code)]
impl Query {
/// Get a simple object
async fn simple_object(&self) -> SimpleObject {
@ -141,6 +142,7 @@ struct Mutation;
/// Global mutation
#[Object]
#[allow(unreachable_code)]
impl Mutation {
/// simple_mutation description
/// line2

View File

@ -12,6 +12,7 @@ pub async fn test_type_visible() {
struct Query;
#[Object]
#[allow(unreachable_code)]
impl Query {
async fn obj(&self) -> MyObj {
todo!()
@ -78,6 +79,7 @@ pub async fn test_field_visible() {
struct Query;
#[Object]
#[allow(unreachable_code)]
impl Query {
async fn obj(&self) -> MyObj {
todo!()
@ -157,6 +159,7 @@ pub async fn test_enum_value_visible() {
struct Query;
#[Object]
#[allow(unreachable_code)]
impl Query {
async fn e(&self) -> MyEnum {
todo!()
@ -218,6 +221,7 @@ pub async fn test_visible_fn() {
struct Query;
#[Object]
#[allow(unreachable_code)]
impl Query {
async fn obj(&self) -> MyObj {
todo!()

View File

@ -9,6 +9,7 @@ struct ObjA<'a> {
struct ObjB<'a>(PhantomData<&'a i32>);
#[Object]
#[allow(unreachable_code)]
impl<'a> ObjB<'a> {
async fn value(&self) -> &'a i32 {
todo!()

View File

@ -16,6 +16,7 @@ pub async fn test_scalar_macro() {
struct Query;
#[Object]
#[allow(unreachable_code)]
impl Query {
async fn value(&self) -> test_mod::MyValue {
todo!()

View File

@ -48,6 +48,7 @@ pub async fn test_object_with_lifetime() {
struct Query;
#[Object]
#[allow(unreachable_code)]
impl Query {
async fn obj(&self) -> MyObj<'_> {
todo!()