Skip to content

Commit 3645df2

Browse files
committed
Stop Clippy from enforcing # Errors and # Panics sections in GraphQL descriptions
1 parent 813c0d1 commit 3645df2

File tree

8 files changed

+33
-0
lines changed

8 files changed

+33
-0
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ cargo.fmt:
5555

5656
cargo.lint:
5757
cargo clippy --workspace --all-features -- -D warnings
58+
cargo clippy -p juniper_integration_tests --tests --all-features -- -D warnings
5859

5960

6061
# Release Rust crate.

juniper_codegen/src/graphql_interface/attr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ fn expand_on_trait(
136136
};
137137

138138
Ok(quote! {
139+
// Omit enforcing `# Errors` and `# Panics` sections in GraphQL descriptions.
140+
#[allow(clippy::missing_errors_doc, clippy::missing_panics_doc)]
139141
#ast
140142
#generated_code
141143
})

juniper_codegen/src/graphql_object/attr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ where
127127
};
128128

129129
Ok(quote! {
130+
// Omit enforcing `# Errors` and `# Panics` sections in GraphQL descriptions.
131+
#[allow(clippy::missing_errors_doc, clippy::missing_panics_doc)]
130132
#ast
131133
#generated_code
132134
})

tests/integration/tests/codegen_interface_attr_trait.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
//! Tests for `#[graphql_interface]` macro placed on a trait.
22
3+
// Assert that `#[graphql_interface]` macro placed on a trait stops Clippy from enforcing `# Errors`
4+
// and `# Panics` sections in GraphQL descriptions.
5+
#![deny(clippy::missing_errors_doc, clippy::missing_panics_doc)]
6+
37
pub mod common;
48

59
use juniper::{
@@ -2370,6 +2374,7 @@ mod explicit_custom_context {
23702374

23712375
#[graphql_object(impl = CharacterValue, context = CustomContext)]
23722376
impl Droid {
2377+
#[allow(clippy::needless_lifetimes)] // intentionally
23732378
async fn id<'a>(&'a self) -> &'a str {
23742379
&self.id
23752380
}
@@ -2378,6 +2383,7 @@ mod explicit_custom_context {
23782383
&self.primary_function
23792384
}
23802385

2386+
#[allow(clippy::needless_lifetimes)] // intentionally
23812387
async fn info<'b>(&'b self) -> &'b str {
23822388
&self.primary_function
23832389
}
@@ -2678,6 +2684,7 @@ mod executor {
26782684
&self.home_planet
26792685
}
26802686

2687+
#[allow(clippy::needless_lifetimes)] // intentionally
26812688
async fn info<'b>(&'b self, _arg: prelude::Option<i32>) -> &'b str {
26822689
&self.home_planet
26832690
}

tests/integration/tests/codegen_object_attr.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
//! Tests for `#[graphql_object]` macro.
22
3+
// Assert that `#[graphql_object]` macro placed on a `impl` stops Clippy from enforcing `# Errors`
4+
// and `# Panics` sections in GraphQL descriptions.
5+
#![deny(clippy::missing_errors_doc, clippy::missing_panics_doc)]
6+
37
pub mod common;
48

59
use juniper::{

tests/integration/tests/codegen_subscription_attr.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
//! Tests for `#[graphql_subscription]` macro.
22
3+
// Assert that `#[graphql_subscription]` macro placed on a `impl` stops Clippy from enforcing
4+
// `# Errors` and `# Panics` sections in GraphQL descriptions.
5+
#![deny(clippy::missing_errors_doc, clippy::missing_panics_doc)]
6+
37
pub mod common;
48

59
use std::pin::Pin;

tests/integration/tests/common/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ pub mod util {
4141
/// Extracts a single next value from the result returned by
4242
/// [`juniper::resolve_into_stream()`] and transforms it into a regular
4343
/// [`Value`].
44+
///
45+
/// # Errors
46+
///
47+
/// Propagates the `input` [`GraphQLError`], if any.
48+
///
49+
/// # Panics
50+
///
51+
/// If the `input` [`Value`] doesn't represent a [`Value::Object`] containing a [`Stream`].
52+
///
53+
/// [`Stream`]: futures::Stream
54+
#[allow(clippy::type_complexity)]
4455
pub async fn extract_next<S: ScalarValue>(
4556
input: Result<(Value<ValuesStream<'_, S>>, Vec<ExecutionError<S>>), GraphQLError>,
4657
) -> Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError> {

tests/integration/tests/issue_914.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
//! Checks that multiple fragments on sub types don't override each other.
22
//! See [#914](https://github.com/graphql-rust/juniper/issues/914) for details.
33
4+
#![allow(clippy::disallowed_names)]
5+
46
use juniper::{graphql_object, graphql_vars, EmptyMutation, EmptySubscription, GraphQLObject};
57

68
struct Query;

0 commit comments

Comments
 (0)