Skip to content

Commit 2ce55df

Browse files
committed
Fix warnings in tests
1 parent b8fbda7 commit 2ce55df

File tree

19 files changed

+58
-19
lines changed

19 files changed

+58
-19
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ jobs:
240240
- run: make test.cargo crate=${{ matrix.crate }}
241241
careful=${{ (matrix.toolchain == 'nightly' && 'yes')
242242
|| 'no' }}
243+
env:
244+
RUSTFLAGS: -D warnings
243245

244246
test-book:
245247
name: test (Book)

benches/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
#[cfg(test)]
2-
mod for_benches_only {
3-
use criterion as _;
4-
use tokio as _;
5-
}
1+
#![cfg_attr(test, expect(unused_crate_dependencies, reason = "benches"))]
62

73
use juniper::{
84
DefaultScalarValue, EmptyMutation, EmptySubscription, ExecutionError, FieldError, GraphQLEnum,

juniper_actix/examples/subscription.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! This example demonstrates asynchronous subscriptions with [`actix_web`].
22
3+
#![expect(unused_crate_dependencies, reason = "example")]
4+
35
use std::{pin::Pin, time::Duration};
46

57
use actix_cors::Cors;

juniper_actix/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![cfg_attr(docsrs, feature(doc_cfg))]
22
#![cfg_attr(any(doc, test), doc = include_str!("../README.md"))]
33
#![cfg_attr(not(any(doc, test)), doc = env!("CARGO_PKG_NAME"))]
4+
#![cfg_attr(test, expect(unused_crate_dependencies, reason = "examples"))]
45

56
use actix_web::{
67
Error, FromRequest, HttpMessage, HttpRequest, HttpResponse, error::JsonPayloadError,
@@ -855,6 +856,7 @@ mod subscription_tests {
855856
(HttpRequest, web::Payload, web::Data<Schema>),
856857
Output = Result<HttpResponse, Error>,
857858
> {
859+
#[expect(closure_returning_async_block, reason = "not possible")]
858860
move |req: HttpRequest, stream: web::Payload, schema: web::Data<Schema>| async move {
859861
let context = Database::new();
860862
let schema = schema.into_inner();

juniper_axum/examples/custom.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
//! [`Handler`]: axum::handler::Handler
44
//! [`starwars::schema`]: juniper::tests::fixtures::starwars::schema
55
6+
#![expect(unused_crate_dependencies, reason = "example")]
7+
68
use std::{net::SocketAddr, sync::Arc};
79

810
use axum::{
@@ -31,7 +33,7 @@ async fn homepage() -> Html<&'static str> {
3133
.into()
3234
}
3335

34-
pub async fn custom_subscriptions(
36+
async fn custom_subscriptions(
3537
Extension(schema): Extension<Arc<Schema>>,
3638
Extension(database): Extension<Database>,
3739
ws: WebSocketUpgrade,

juniper_axum/examples/simple.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! This example demonstrates simple default integration with [`axum`].
22
3+
#![expect(unused_crate_dependencies, reason = "example")]
4+
35
use std::{net::SocketAddr, sync::Arc, time::Duration};
46

57
use axum::{
@@ -15,7 +17,7 @@ use tokio::{net::TcpListener, time::interval};
1517
use tokio_stream::wrappers::IntervalStream;
1618

1719
#[derive(Clone, Copy, Debug)]
18-
pub struct Query;
20+
struct Query;
1921

2022
#[graphql_object]
2123
impl Query {
@@ -26,7 +28,7 @@ impl Query {
2628
}
2729

2830
#[derive(Clone, Copy, Debug)]
29-
pub struct Subscription;
31+
struct Subscription;
3032

3133
type NumberStream = BoxStream<'static, Result<i32, FieldError>>;
3234

juniper_axum/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#![cfg_attr(docsrs, feature(doc_cfg))]
22
#![cfg_attr(any(doc, test), doc = include_str!("../README.md"))]
33
#![cfg_attr(not(any(doc, test)), doc = env!("CARGO_PKG_NAME"))]
4+
#![cfg_attr(
5+
test,
6+
expect(unused_crate_dependencies, reason = "examples and integration tests")
7+
)]
48

59
// TODO: Try remove on upgrade of `axum` crate.
610
mod for_minimal_versions_check_only {

juniper_axum/tests/http_test_suite.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! [`HttpIntegration`] testing for [`axum`].
2+
3+
#![expect(unused_crate_dependencies, reason = "integration tests")]
4+
15
use std::sync::Arc;
26

37
use axum::{

juniper_axum/tests/ws_test_suite.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
#![cfg(not(windows))]
1+
//! [`WsIntegration`] testing for [`axum`].
2+
3+
#![expect(unused_crate_dependencies, reason = "integration tests")]
4+
#![cfg_attr(windows, expect(dead_code, unused_imports, reason = "disabled"))]
25

36
use std::{net::SocketAddr, sync::Arc};
47

@@ -127,12 +130,14 @@ impl WsIntegration for TestApp {
127130
}
128131
}
129132

133+
#[cfg(not(windows))]
130134
#[tokio::test]
131135
async fn test_graphql_ws_integration() {
132136
let app = TestApp::new("graphql-ws");
133137
graphql_ws::run_test_suite(&app).await;
134138
}
135139

140+
#[cfg(not(windows))]
136141
#[tokio::test]
137142
async fn test_graphql_transport_integration() {
138143
let app = TestApp::new("graphql-transport-ws");

juniper_codegen/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#![cfg_attr(any(doc, test), doc = include_str!("../README.md"))]
22
#![cfg_attr(not(any(doc, test)), doc = env!("CARGO_PKG_NAME"))]
33
#![recursion_limit = "1024"]
4+
#![cfg_attr(
5+
all(test, not(doctest)),
6+
expect(unused_crate_dependencies, reason = "for doc tests only")
7+
)]
48

59
// NOTICE: Unfortunately this macro MUST be defined here, in the crate's root module, because Rust
610
// doesn't allow to export `macro_rules!` macros from a `proc-macro` crate type currently,

0 commit comments

Comments
 (0)