Stop Clippy from enforcing # Errors and # Panics sections in GraphQL descriptions

This commit is contained in:
tyranron 2023-11-17 21:38:17 +01:00
parent 813c0d1210
commit 3645df27b6
No known key found for this signature in database
GPG key ID: 762E144FB230A4F0
8 changed files with 33 additions and 0 deletions

View file

@ -55,6 +55,7 @@ cargo.fmt:
cargo.lint: cargo.lint:
cargo clippy --workspace --all-features -- -D warnings cargo clippy --workspace --all-features -- -D warnings
cargo clippy -p juniper_integration_tests --tests --all-features -- -D warnings
# Release Rust crate. # Release Rust crate.

View file

@ -136,6 +136,8 @@ fn expand_on_trait(
}; };
Ok(quote! { Ok(quote! {
// Omit enforcing `# Errors` and `# Panics` sections in GraphQL descriptions.
#[allow(clippy::missing_errors_doc, clippy::missing_panics_doc)]
#ast #ast
#generated_code #generated_code
}) })

View file

@ -127,6 +127,8 @@ where
}; };
Ok(quote! { Ok(quote! {
// Omit enforcing `# Errors` and `# Panics` sections in GraphQL descriptions.
#[allow(clippy::missing_errors_doc, clippy::missing_panics_doc)]
#ast #ast
#generated_code #generated_code
}) })

View file

@ -1,5 +1,9 @@
//! Tests for `#[graphql_interface]` macro placed on a trait. //! Tests for `#[graphql_interface]` macro placed on a trait.
// Assert that `#[graphql_interface]` macro placed on a trait stops Clippy from enforcing `# Errors`
// and `# Panics` sections in GraphQL descriptions.
#![deny(clippy::missing_errors_doc, clippy::missing_panics_doc)]
pub mod common; pub mod common;
use juniper::{ use juniper::{
@ -2370,6 +2374,7 @@ mod explicit_custom_context {
#[graphql_object(impl = CharacterValue, context = CustomContext)] #[graphql_object(impl = CharacterValue, context = CustomContext)]
impl Droid { impl Droid {
#[allow(clippy::needless_lifetimes)] // intentionally
async fn id<'a>(&'a self) -> &'a str { async fn id<'a>(&'a self) -> &'a str {
&self.id &self.id
} }
@ -2378,6 +2383,7 @@ mod explicit_custom_context {
&self.primary_function &self.primary_function
} }
#[allow(clippy::needless_lifetimes)] // intentionally
async fn info<'b>(&'b self) -> &'b str { async fn info<'b>(&'b self) -> &'b str {
&self.primary_function &self.primary_function
} }
@ -2678,6 +2684,7 @@ mod executor {
&self.home_planet &self.home_planet
} }
#[allow(clippy::needless_lifetimes)] // intentionally
async fn info<'b>(&'b self, _arg: prelude::Option<i32>) -> &'b str { async fn info<'b>(&'b self, _arg: prelude::Option<i32>) -> &'b str {
&self.home_planet &self.home_planet
} }

View file

@ -1,5 +1,9 @@
//! Tests for `#[graphql_object]` macro. //! Tests for `#[graphql_object]` macro.
// Assert that `#[graphql_object]` macro placed on a `impl` stops Clippy from enforcing `# Errors`
// and `# Panics` sections in GraphQL descriptions.
#![deny(clippy::missing_errors_doc, clippy::missing_panics_doc)]
pub mod common; pub mod common;
use juniper::{ use juniper::{

View file

@ -1,5 +1,9 @@
//! Tests for `#[graphql_subscription]` macro. //! Tests for `#[graphql_subscription]` macro.
// Assert that `#[graphql_subscription]` macro placed on a `impl` stops Clippy from enforcing
// `# Errors` and `# Panics` sections in GraphQL descriptions.
#![deny(clippy::missing_errors_doc, clippy::missing_panics_doc)]
pub mod common; pub mod common;
use std::pin::Pin; use std::pin::Pin;

View file

@ -41,6 +41,17 @@ pub mod util {
/// Extracts a single next value from the result returned by /// Extracts a single next value from the result returned by
/// [`juniper::resolve_into_stream()`] and transforms it into a regular /// [`juniper::resolve_into_stream()`] and transforms it into a regular
/// [`Value`]. /// [`Value`].
///
/// # Errors
///
/// Propagates the `input` [`GraphQLError`], if any.
///
/// # Panics
///
/// If the `input` [`Value`] doesn't represent a [`Value::Object`] containing a [`Stream`].
///
/// [`Stream`]: futures::Stream
#[allow(clippy::type_complexity)]
pub async fn extract_next<S: ScalarValue>( pub async fn extract_next<S: ScalarValue>(
input: Result<(Value<ValuesStream<'_, S>>, Vec<ExecutionError<S>>), GraphQLError>, input: Result<(Value<ValuesStream<'_, S>>, Vec<ExecutionError<S>>), GraphQLError>,
) -> Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError> { ) -> Result<(Value<S>, Vec<ExecutionError<S>>), GraphQLError> {

View file

@ -1,6 +1,8 @@
//! Checks that multiple fragments on sub types don't override each other. //! Checks that multiple fragments on sub types don't override each other.
//! See [#914](https://github.com/graphql-rust/juniper/issues/914) for details. //! See [#914](https://github.com/graphql-rust/juniper/issues/914) for details.
#![allow(clippy::disallowed_names)]
use juniper::{graphql_object, graphql_vars, EmptyMutation, EmptySubscription, GraphQLObject}; use juniper::{graphql_object, graphql_vars, EmptyMutation, EmptySubscription, GraphQLObject};
struct Query; struct Query;