Skip to content

Commit

Permalink
Fix lint and tests (#35)
Browse files Browse the repository at this point in the history
* fix lint errors

* update tests
  • Loading branch information
smmoosavi authored Jun 26, 2024
1 parent 4308e86 commit 49bf6c5
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions derive/src/args/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ mod root;

#[derive(Debug, Clone)]
pub struct InterfaceArg {
#[allow(dead_code)]
pub ident: syn::Ident,
}

Expand Down
1 change: 1 addition & 0 deletions derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::manual_unwrap_or_default)]
extern crate core;
extern crate proc_macro;

Expand Down
1 change: 1 addition & 0 deletions derive/src/utils/impl_block/base_item_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::FromItemImpl;

#[derive(Debug, Clone)]
pub struct BaseItemImpl<Method = BaseMethod, Generics = ()> {
#[allow(dead_code)]
pub trait_: Option<syn::Path>,
pub ty: syn::Type,
pub methods: Methods<Method>,
Expand Down
2 changes: 2 additions & 0 deletions derive/src/utils/impl_block/from_fn_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ pub trait FromFnArg: Sized {

#[derive(Debug, Clone)]
pub struct SelfArg {
#[allow(dead_code)]
pub is_mut: bool,
#[allow(dead_code)]
pub is_ref: bool,
pub span: proc_macro2::Span,
}
Expand Down
2 changes: 2 additions & 0 deletions derive/src/utils/interface_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ use crate::utils::meta_match::MatchNestedMetaList;
#[derive(Debug, Clone)]
pub struct InterfaceMarkAttr {
pub path: syn::Path,
#[allow(dead_code)]
pub span: Span,
}

#[derive(Debug, Clone)]
pub struct InterfaceImplAttr {
pub path: syn::Path,
#[allow(dead_code)]
pub span: Span,
}

Expand Down
1 change: 1 addition & 0 deletions derive/src/utils/meta_match/match_lit_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::ops::Deref;
use crate::utils::meta_match::MatchNestedMeta;
use crate::utils::meta_match::MatchString;

#[allow(dead_code)]
pub struct MatchLitStr<S: MatchString = String>(pub S, pub proc_macro2::Span);

impl<S: MatchString> Deref for MatchLitStr<S> {
Expand Down
1 change: 1 addition & 0 deletions derive/src/utils/register_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::utils::meta_match::MatchNestedMetaList;
#[derive(Debug, Clone)]
pub struct RegisterAttr {
pub path: syn::Path,
#[allow(dead_code)]
pub span: Span,
}

Expand Down
2 changes: 2 additions & 0 deletions derive/tests/expand_object/expand_object_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ fn test_schema_with_deprecation() {
old: Example! @deprecated(reason: "this is the old one")
}
directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
Expand Down
2 changes: 2 additions & 0 deletions derive/tests/gql_enum/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ async fn test_deprecation() {
byExample(example: Example!): Example!
}
directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
Expand Down
2 changes: 2 additions & 0 deletions derive/tests/resolved_object/resolved_object_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ fn test_schema_with_deprecation() {
withReason: String! @deprecated(reason: "this is the old one")
}
directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
Expand Down
6 changes: 6 additions & 0 deletions derive/tests/scalar/scalar_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,12 @@ fn test_schema_with_specified_by_url() {
value: MyString!
}
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @specifiedBy(url: String!) on SCALAR
schema {
query: Query
}
Expand Down
2 changes: 2 additions & 0 deletions derive/tests/simple_object/object_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ fn test_schema_with_deprecation() {
withReason: String! @deprecated(reason: "this is the old one")
}
directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
Expand Down
8 changes: 8 additions & 0 deletions derive/tests/upload/upload_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ async fn test_arg() {
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @specifiedBy(url: String!) on SCALAR
schema {
query: Query
mutation: MutationRoot
Expand Down Expand Up @@ -164,6 +166,8 @@ async fn test_input_object() {
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @specifiedBy(url: String!) on SCALAR
schema {
query: Query
mutation: MutationRoot
Expand Down Expand Up @@ -243,6 +247,8 @@ async fn test_arg_optional() {
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @specifiedBy(url: String!) on SCALAR
schema {
query: Query
mutation: MutationRoot
Expand Down Expand Up @@ -340,6 +346,8 @@ async fn test_input_object_optional() {
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @specifiedBy(url: String!) on SCALAR
schema {
query: Query
mutation: MutationRoot
Expand Down
2 changes: 2 additions & 0 deletions src/docs/resolved-object-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ type Query {
fourthField: Int!
}
directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
Expand Down
2 changes: 2 additions & 0 deletions src/docs/simple-object.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ type Query {
myField: String!
}
directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
Expand Down

0 comments on commit 49bf6c5

Please sign in to comment.