Skip to content

Commit 227a9b9

Browse files
committed
Bootstrap, vol.1
1 parent 1996e35 commit 227a9b9

File tree

41 files changed

+233
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+233
-57
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
resolver = "1" # unifying Cargo features asap for Book tests
33
members = [
44
"benches",
5+
"book",
56
"juniper_codegen",
67
"juniper",
78
"juniper_hyper",

benches/Cargo.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ authors = ["Christoph Herzog <[email protected]>"]
66
publish = false
77

88
[dependencies]
9-
dataloader = "0.18" # for Book only
10-
futures = "0.3"
119
juniper = { path = "../juniper" }
1210

1311
[dev-dependencies]
1412
criterion = "0.5"
1513
tokio = { version = "1.0", features = ["rt-multi-thread"] }
1614

15+
[lints.clippy]
16+
allow_attributes = "warn"
17+
allow_attributes_without_reason = "warn"
18+
[lints.rust]
19+
closure_returning_async_block = "warn"
20+
future_incompatible = { level = "warn", priority = -1 }
21+
impl_trait_redundant_captures = "warn"
22+
non_ascii_idents = "forbid"
23+
unsafe_code = "forbid"
24+
unused_crate_dependencies = "warn"
25+
1726
[[bench]]
1827
name = "benchmark"
1928
harness = false

book/Cargo.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "juniper_book"
3+
version = "0.0.0"
4+
edition = "2024"
5+
authors = ["Kai Ren <[email protected]>"]
6+
publish = false
7+
8+
[dependencies]
9+
dataloader = "0.18" # for Book only
10+
11+
[lints.clippy]
12+
allow_attributes = "warn"
13+
allow_attributes_without_reason = "warn"
14+
[lints.rust]
15+
closure_returning_async_block = "warn"
16+
future_incompatible = { level = "warn", priority = -1 }
17+
impl_trait_redundant_captures = "warn"
18+
non_ascii_idents = "forbid"
19+
unsafe_code = "forbid"
20+
unused_crate_dependencies = "warn"

book/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! Crate keeping dependencies for running Book tests.
2+
3+
use dataloader as _;

juniper/Cargo.toml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,19 @@ serde_json = "1.0.18"
8484
serial_test = "3.0"
8585
tokio = { version = "1.0", features = ["macros", "time", "rt-multi-thread"] }
8686

87+
[lints.clippy]
88+
allow_attributes = "warn"
89+
allow_attributes_without_reason = "warn"
90+
[lints.rust]
91+
closure_returning_async_block = "warn"
92+
future_incompatible = { level = "warn", priority = -1 }
93+
impl_trait_redundant_captures = "warn"
94+
missing_docs = "warn"
95+
non_ascii_idents = "forbid"
96+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(nightly)'] }
97+
unused_crate_dependencies = "warn"
98+
8799
[[bench]]
88100
name = "bench"
89101
harness = false
90102
path = "benches/bench.rs"
91-
92-
[lints.rust]
93-
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(nightly)'] }

juniper/src/ast.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub enum Type<'a> {
3535
/// Lists and objects variants are _spanned_, i.e. they contain a reference to
3636
/// their position in the source file, if available.
3737
#[derive(Clone, Debug, PartialEq)]
38-
#[allow(missing_docs)]
38+
#[expect(missing_docs, reason = "self-explanatory")]
3939
pub enum InputValue<S = DefaultScalarValue> {
4040
Null,
4141
Scalar(S),
@@ -100,7 +100,7 @@ pub struct InlineFragment<'a, S> {
100100
/// }
101101
/// ```
102102
#[derive(Clone, PartialEq, Debug)]
103-
#[allow(missing_docs)]
103+
#[expect(missing_docs, reason = "self-explanatory")]
104104
pub enum Selection<'a, S = DefaultScalarValue> {
105105
Field(Spanning<Field<'a, S>>),
106106
FragmentSpread(Spanning<FragmentSpread<'a, S>>),
@@ -113,15 +113,15 @@ pub struct Directive<'a, S> {
113113
pub arguments: Option<Spanning<Arguments<'a, S>>>,
114114
}
115115

116-
#[allow(missing_docs)]
116+
#[expect(missing_docs, reason = "self-explanatory")]
117117
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
118118
pub enum OperationType {
119119
Query,
120120
Mutation,
121121
Subscription,
122122
}
123123

124-
#[allow(missing_docs)]
124+
#[expect(missing_docs, reason = "self-explanatory")]
125125
#[derive(Clone, PartialEq, Debug)]
126126
pub struct Operation<'a, S> {
127127
pub operation_type: OperationType,

juniper/src/executor/look_ahead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ type BorrowedSpanning<'a, T> = Spanning<T, &'a Span>;
2828
/// variables get automatically resolved.
2929
///
3030
/// [0]: https://en.wikipedia.org/wiki/Look-ahead_(backtracking)
31+
#[expect(missing_docs, reason = "self-explanatory")]
3132
#[derive(Clone, Debug, PartialEq)]
32-
#[allow(missing_docs)]
3333
#[must_use]
3434
pub enum LookAheadValue<'a, S: ScalarValue + 'a> {
3535
Null,

juniper/src/executor/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub struct Registry<'r, S = DefaultScalarValue> {
5656
pub types: FnvHashMap<Name, MetaType<'r, S>>,
5757
}
5858

59-
#[allow(missing_docs)]
59+
#[expect(missing_docs, reason = "self-explanatory")]
6060
#[derive(Clone)]
6161
pub enum FieldPath<'a> {
6262
Root(SourcePosition),
@@ -349,7 +349,6 @@ where
349349
{
350350
type Type = T;
351351

352-
#[allow(clippy::type_complexity)]
353352
fn into_resolvable(self, _: &'a C) -> FieldResult<Option<(&'a T::Context, Option<T>)>, S> {
354353
Ok(self.map(|(ctx, v)| (ctx, Some(v))))
355354
}
@@ -377,7 +376,6 @@ where
377376
{
378377
type Type = T;
379378

380-
#[allow(clippy::type_complexity)]
381379
fn into_resolvable(self, _: &'a C) -> FieldResult<Option<(&'a T::Context, Option<T>)>, S2> {
382380
self.map(|o| o.map(|(ctx, v)| (ctx, Some(v))))
383381
.map_err(FieldError::map_scalar_value)

juniper/src/http/mod.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,8 +361,9 @@ impl<S: ScalarValue> GraphQLBatchResponse<S> {
361361
}
362362

363363
#[cfg(feature = "expose-test-schema")]
364-
#[allow(missing_docs)]
365364
pub mod tests {
365+
//! HTTP integration tests.
366+
366367
use std::time::Duration;
367368

368369
use serde_json::Value as Json;
@@ -373,8 +374,13 @@ pub mod tests {
373374
/// the http framework integration we are testing.
374375
#[derive(Debug)]
375376
pub struct TestResponse {
377+
/// Status code of the HTTP response.
376378
pub status_code: i32,
379+
380+
/// Body of the HTTP response, if any.
377381
pub body: Option<String>,
382+
383+
/// `Content-Type` header value of the HTTP response.
378384
pub content_type: String,
379385
}
380386

@@ -393,7 +399,7 @@ pub mod tests {
393399
fn post_graphql(&self, url: &str, body: &str) -> TestResponse;
394400
}
395401

396-
#[allow(missing_docs)]
402+
/// Runs integration tests suite for the provided [`HttpIntegration`].
397403
pub fn run_http_test_suite<T: HttpIntegration>(integration: &T) {
398404
println!("Running HTTP Test suite for integration");
399405

@@ -662,7 +668,10 @@ pub mod tests {
662668

663669
use super::{WS_INTEGRATION_EXPECT_DEFAULT_TIMEOUT, WsIntegration, WsIntegrationMessage};
664670

665-
#[allow(missing_docs)]
671+
/// Runs integration tests suite for the [legacy `graphql-ws` GraphQL over WebSocket
672+
/// Protocol][0].
673+
///
674+
/// [0]:https://github.com/apollographql/subscriptions-transport-ws/blob/v0.11.0/PROTOCOL.md
666675
pub async fn run_test_suite<T: WsIntegration>(integration: &T) {
667676
println!("Running `graphql-ws` test suite for integration");
668677

@@ -791,7 +800,10 @@ pub mod tests {
791800

792801
use super::{WS_INTEGRATION_EXPECT_DEFAULT_TIMEOUT, WsIntegration, WsIntegrationMessage};
793802

794-
#[allow(missing_docs)]
803+
/// Runs integration tests suite the [new `graphql-transport-ws` GraphQL over WebSocket
804+
/// Protocol][new].
805+
///
806+
/// [new]: https://github.com/enisdenjo/graphql-ws/blob/v5.14.0/PROTOCOL.md
795807
pub async fn run_test_suite<T: WsIntegration>(integration: &T) {
796808
println!("Running `graphql-transport-ws` test suite for integration");
797809

juniper/src/integrations/bigdecimal.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ use std::str::FromStr as _;
1212

1313
use crate::{InputValue, ScalarValue, Value, graphql_scalar};
1414

15+
// TODO: Try remove on upgrade of `bigdecimal` crate.
16+
mod for_minimal_versions_check_only {
17+
use num_bigint as _;
18+
}
19+
1520
/// Big decimal type.
1621
///
1722
/// Allows storing any real number to arbitrary precision; which avoids common

0 commit comments

Comments
 (0)