Skip to content

Commit 1b1fc61

Browse files
committed
Switch to 2024 Rust edition
- bump up MSRV to 1.85 - tune lints for 1.85 Rust
1 parent 66b19fa commit 1b1fc61

File tree

215 files changed

+799
-788
lines changed

Some content is hidden

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

215 files changed

+799
-788
lines changed

.github/workflows/ci.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -145,25 +145,21 @@ jobs:
145145
strategy:
146146
fail-fast: false
147147
matrix:
148-
msrv: ["1.75.0"]
148+
msrv: ["1.85.0"]
149149
crate:
150150
- juniper_codegen
151151
- juniper
152152
- juniper_subscriptions
153153
- juniper_graphql_ws
154154
- juniper_actix
155155
- juniper_axum
156-
#- juniper_hyper
156+
- juniper_hyper
157157
- juniper_rocket
158158
- juniper_warp
159159
os:
160160
- ubuntu
161161
- macOS
162162
- windows
163-
include:
164-
- { msrv: "1.79.0", crate: "juniper_hyper", os: "ubuntu" }
165-
- { msrv: "1.79.0", crate: "juniper_hyper", os: "macOS" }
166-
- { msrv: "1.79.0", crate: "juniper_hyper", os: "windows" }
167163
runs-on: ${{ matrix.os }}-latest
168164
steps:
169165
- uses: actions/checkout@v4

benches/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "juniper_benchmarks"
33
version = "0.0.0"
4-
edition = "2021"
4+
edition = "2024"
55
authors = ["Christoph Herzog <[email protected]>"]
66
publish = false
77

benches/benches/benchmark.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
1+
use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main};
22

33
use juniper::InputValue;
44
use juniper_benchmarks as j;

benches/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use juniper::{
2-
graphql_object, DefaultScalarValue, EmptyMutation, EmptySubscription, ExecutionError,
3-
FieldError, GraphQLEnum, GraphQLObject, RootNode, Value, Variables,
2+
DefaultScalarValue, EmptyMutation, EmptySubscription, ExecutionError, FieldError, GraphQLEnum,
3+
GraphQLObject, RootNode, Value, Variables, graphql_object,
44
};
55

66
pub type QueryResult = Result<

book/book.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ create-missing = false
1616
git_repository_url = "https://github.com/graphql-rust/juniper"
1717

1818
[rust]
19-
edition = "2021"
19+
edition = "2024"

book/src/advanced/dataloader.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Let's remake our [example of N+1 problem](n_plus_1.md), so it's solved by applyi
1515
# use std::{collections::HashMap, sync::Arc};
1616
# use anyhow::anyhow;
1717
# use dataloader::non_cached::Loader;
18-
# use juniper::{graphql_object, GraphQLObject};
18+
# use juniper::{GraphQLObject, graphql_object};
1919
#
2020
# type CultId = i32;
2121
# type UserId = i32;

book/src/advanced/implicit_and_explicit_null.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The last two cases rely on being able to distinguish between [explicit and impli
5555
Unfortunately, plain `Option` is not capable to distinguish them. That's why in [Juniper], this can be done using the [`Nullable`] type:
5656
```rust
5757
# extern crate juniper;
58-
use juniper::{graphql_object, FieldResult, GraphQLInputObject, Nullable};
58+
use juniper::{FieldResult, GraphQLInputObject, Nullable, graphql_object};
5959

6060
#[derive(GraphQLInputObject)]
6161
struct UserPatchInput {

book/src/advanced/lookahead.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ In [GraphQL], look-ahead machinery allows us to introspect the currently [execut
88
In [Juniper], it's represented by the [`Executor::look_ahead()`][20] method.
99
```rust
1010
# extern crate juniper;
11-
# use juniper::{graphql_object, Executor, GraphQLObject, ScalarValue};
11+
# use juniper::{Executor, GraphQLObject, ScalarValue, graphql_object};
1212
#
1313
# type UserId = i32;
1414
#

book/src/advanced/n_plus_1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A common issue with [GraphQL] server implementations is how the [resolvers][2] q
77
# extern crate anyhow;
88
# extern crate juniper;
99
# use anyhow::anyhow;
10-
# use juniper::{graphql_object, GraphQLObject};
10+
# use juniper::{GraphQLObject, graphql_object};
1111
#
1212
# type CultId = i32;
1313
# type UserId = i32;

book/src/quickstart.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ For more advanced mappings, [Juniper] provides multiple macros to map your [Rust
3333
# use std::fmt::Display;
3434
#
3535
use juniper::{
36-
graphql_object, EmptySubscription, FieldResult, GraphQLEnum,
37-
GraphQLInputObject, GraphQLObject, ScalarValue,
36+
EmptySubscription, FieldResult, GraphQLEnum, GraphQLInputObject,
37+
GraphQLObject, ScalarValue, graphql_object,
3838
};
3939
#
4040
# struct DatabasePool;
@@ -162,8 +162,8 @@ To actually serve the [schema], see the guides for our various [server integrati
162162
# // Only needed due to 2018 edition because the macro is not accessible.
163163
# #[macro_use] extern crate juniper;
164164
use juniper::{
165-
graphql_object, graphql_value, EmptyMutation, EmptySubscription,
166-
GraphQLEnum, Variables,
165+
EmptyMutation, EmptySubscription, GraphQLEnum, Variables,
166+
graphql_object, graphql_value,
167167
};
168168

169169
#[derive(GraphQLEnum, Clone, Copy)]

book/src/schema/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Both [query][1] and [mutation][2] objects are regular [GraphQL objects][4], defi
2424
```rust
2525
# extern crate juniper;
2626
# use juniper::{
27-
# graphql_object, EmptySubscription, FieldResult, GraphQLObject, RootNode,
27+
# EmptySubscription, FieldResult, GraphQLObject, RootNode, graphql_object,
2828
# };
2929
#
3030
#[derive(GraphQLObject)]

book/src/schema/introspection.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Because [introspection][0] queries are just regular [GraphQL queries][2], [Junip
3232
```rust
3333
# extern crate juniper;
3434
# use juniper::{
35-
# graphql_object, graphql_vars, EmptyMutation, EmptySubscription, GraphQLError,
36-
# RootNode,
35+
# EmptyMutation, EmptySubscription, GraphQLError, RootNode,
36+
# graphql_object, graphql_vars,
3737
# };
3838
#
3939
pub struct Query;

book/src/schema/subscriptions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The [subscription root][3] is just a [GraphQL object][4], similar to the [query
1212
# extern crate juniper;
1313
# use std::pin::Pin;
1414
# use futures::Stream;
15-
# use juniper::{graphql_object, graphql_subscription, FieldError};
15+
# use juniper::{FieldError, graphql_object, graphql_subscription};
1616
#
1717
# #[derive(Clone)]
1818
# pub struct Database;

book/src/types/input_objects.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ In [Juniper], defining a [GraphQL input object][0] is quite straightforward and
99
```rust
1010
# #![allow(unused_variables)]
1111
# extern crate juniper;
12-
# use juniper::{graphql_object, GraphQLInputObject, GraphQLObject};
12+
# use juniper::{GraphQLInputObject, GraphQLObject, graphql_object};
1313
#
1414
#[derive(GraphQLInputObject)]
1515
struct Coordinate {

book/src/types/interfaces.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ That's why [Juniper] takes the following approach to represent [GraphQL interfac
1414
This may be done by using either the [`#[graphql_interface]` attribute][3] or the [`#[derive(GraphQLInterface)]`][2]:
1515
```rust
1616
# extern crate juniper;
17-
# use juniper::{graphql_interface, GraphQLInterface, GraphQLObject};
17+
# use juniper::{GraphQLInterface, GraphQLObject, graphql_interface};
1818
#
1919
// By default a `CharacterValue` enum is generated by macro to represent
2020
// values of this GraphQL interface.

book/src/types/objects/complex_fields.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Using a plain [Rust struct][struct] for representing a [GraphQL object][0] is ea
1010
To support these more complicated use cases, we need a way to define a [GraphQL field][4] as a function. In [Juniper] this is achievable by placing the [`#[graphql_object]` attribute][3] on an [`impl` block][6], which turns its methods into [GraphQL fields][4]:
1111
```rust
1212
# extern crate juniper;
13-
# use juniper::{graphql_object, GraphQLObject};
13+
# use juniper::{GraphQLObject, graphql_object};
1414
#
1515
#[derive(GraphQLObject)]
1616
struct Person {

book/src/types/objects/error/field.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ For recoverable errors, [Juniper] works well with the [built-in `Result` type][1
1111
```rust
1212
# extern crate juniper;
1313
# use std::{fs::File, io::Read, path::PathBuf, str};
14-
# use juniper::{graphql_object, FieldResult};
14+
# use juniper::{FieldResult, graphql_object};
1515
#
1616
struct Example {
1717
filename: PathBuf,
@@ -108,7 +108,7 @@ If the `File::open()` above results in a `std::io::ErrorKind::PermissionDenied`,
108108
Sometimes it's desirable to return additional structured error information to clients. This can be accomplished by implementing the [`IntoFieldError` trait][23]:
109109
```rust
110110
# #[macro_use] extern crate juniper;
111-
# use juniper::{graphql_object, FieldError, IntoFieldError, ScalarValue};
111+
# use juniper::{FieldError, IntoFieldError, ScalarValue, graphql_object};
112112
#
113113
enum CustomError {
114114
WhateverNotSet,

book/src/types/objects/error/schema.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Critical errors are returned from resolvers as [field errors][1] (from the [prev
1717
In this example, basic input validation is implemented with [GraphQL types][7]. [Strings][5] are used to identify the problematic [field][6] name. Errors for a particular [field][6] are also returned as a [string][5].
1818
```rust
1919
# extern crate juniper;
20-
# use juniper::{graphql_object, GraphQLObject, GraphQLUnion};
20+
# use juniper::{GraphQLObject, GraphQLUnion, graphql_object};
2121
#
2222
#[derive(GraphQLObject)]
2323
pub struct Item {
@@ -108,7 +108,7 @@ Instead of using [strings][5] to propagate errors, it is possible to use [GraphQ
108108
For each fallible [input argument][4] we create a [field][6] in a [GraphQL object][10]. The [field][6] is set if the validation for that particular [argument][4] fails.
109109
```rust
110110
# extern crate juniper;
111-
# use juniper::{graphql_object, GraphQLObject, GraphQLUnion};
111+
# use juniper::{GraphQLObject, GraphQLUnion, graphql_object};
112112
#
113113
#[derive(GraphQLObject)]
114114
pub struct Item {
@@ -184,7 +184,7 @@ Our examples so far have only included non-critical errors. Providing errors ins
184184
In the following example, a theoretical database could fail and would generate errors. Since it is not common for a database to fail, the corresponding error is returned as a [critical error][1]:
185185
```rust
186186
# extern crate juniper;
187-
# use juniper::{graphql_object, graphql_value, FieldError, GraphQLObject, GraphQLUnion, ScalarValue};
187+
# use juniper::{FieldError, GraphQLObject, GraphQLUnion, ScalarValue, graphql_object, graphql_value};
188188
#
189189
#[derive(GraphQLObject)]
190190
pub struct Item {
@@ -261,7 +261,7 @@ Up until now, we've only looked at mapping [structs][20] to [GraphQL objects][10
261261
Using `Result`-like [enums][1] can be a useful way of reporting validation errors from a mutation:
262262
```rust
263263
# extern crate juniper;
264-
# use juniper::{graphql_object, GraphQLObject};
264+
# use juniper::{GraphQLObject, graphql_object};
265265
#
266266
#[derive(GraphQLObject)]
267267
struct User {

book/src/types/objects/generics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This poses a restriction on what we can expose in [GraphQL] from [Rust]: no gene
1010
Let's make a slightly more compact but generic implementation of [the last schema error example](error/schema.md#example-non-struct-objects):
1111
```rust
1212
# extern crate juniper;
13-
# use juniper::{graphql_object, GraphQLObject};
13+
# use juniper::{GraphQLObject, graphql_object};
1414
#
1515
#[derive(GraphQLObject)]
1616
struct User {

book/src/types/scalars.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ We can create [custom scalars][2] for other primitive values, but they are still
3737
Quite often, we want to create a [custom GraphQL scalar][2] type by just wrapping an existing one, inheriting all its behavior. In [Rust], this is often called as ["newtype pattern"][3]. This may be achieved by providing a `#[graphql(transparent)]` attribute to the definition:
3838
```rust
3939
# extern crate juniper;
40-
# use juniper::{graphql_scalar, GraphQLScalar};
40+
# use juniper::{GraphQLScalar, graphql_scalar};
4141
#
4242
#[derive(GraphQLScalar)]
4343
#[graphql(transparent)]
@@ -352,7 +352,7 @@ For implementing [custom scalars][2] on foreign types there is [`#[graphql_scala
352352
# }
353353
#
354354
# use juniper::DefaultScalarValue as CustomScalarValue;
355-
use juniper::{graphql_scalar, InputValue, ScalarValue, Value};
355+
use juniper::{InputValue, ScalarValue, Value, graphql_scalar};
356356

357357
#[graphql_scalar(
358358
with = date_scalar,

juniper/CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
1313
### BC Breaks
1414

1515
- Upgraded [`chrono-tz` crate] integration to [0.10 version](https://github.com/chronotope/chrono-tz/releases/tag/v0.10.0). ([#1252], [#1284])
16-
- Bumped up [MSRV] to 1.75. ([#1272])
16+
- Bumped up [MSRV] to 1.85. ([#1272], [todo])
1717
- Corrected compliance with newer [graphql-scalars.dev] specs: ([#1275], [#1277])
1818
- Switched `LocalDateTime` scalars to `yyyy-MM-ddTHH:mm:ss` format in types:
1919
- `chrono::NaiveDateTime`.
@@ -59,6 +59,7 @@ All user visible changes to `juniper` crate will be documented in this file. Thi
5959
[#1284]: /../../pull/1284
6060
[#1300]: /../../pull/1300
6161
[#1311]: /../../pull/1311
62+
[todo]: /../../commit/todo
6263

6364

6465

juniper/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "juniper"
33
version = "0.16.1"
4-
edition = "2021"
5-
rust-version = "1.75"
4+
edition = "2024"
5+
rust-version = "1.85"
66
description = "GraphQL server library."
77
license = "BSD-2-Clause"
88
authors = [

juniper/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Juniper (GraphQL server library for Rust)
33

44
[![Crates.io](https://img.shields.io/crates/v/juniper.svg?maxAge=2592000)](https://crates.io/crates/juniper)
55
[![Documentation](https://docs.rs/juniper/badge.svg)](https://docs.rs/juniper)
6-
[![CI](https://github.com/graphql-rust/juniper/workflows/CI/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
7-
[![Rust 1.75+](https://img.shields.io/badge/rustc-1.75+-lightgray.svg "Rust 1.75+")](https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html)
6+
[![CI](https://github.com/graphql-rust/juniper/actions/workflows/ci.yml/badge.svg?branch=master "CI")](https://github.com/graphql-rust/juniper/actions?query=workflow%3ACI+branch%3Amaster)
7+
[![Rust 1.85+](https://img.shields.io/badge/rustc-1.85+-lightgray.svg "Rust 1.85+")](https://blog.rust-lang.org/2025/02/20/Rust-1.85.0.html)
88

99
- [Juniper Book] ([current][Juniper Book] | [edge][Juniper Book edge])
1010
- [Changelog](https://github.com/graphql-rust/juniper/blob/juniper-v0.16.1/juniper/CHANGELOG.md)

juniper/benches/bench.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
use bencher::{benchmark_group, benchmark_main, Bencher};
1+
use bencher::{Bencher, benchmark_group, benchmark_main};
22
use juniper::{
3-
execute_sync, graphql_vars,
3+
DefaultScalarValue, EmptyMutation, EmptySubscription, RootNode, execute_sync, graphql_vars,
44
tests::fixtures::starwars::schema::{Database, Query},
5-
DefaultScalarValue, EmptyMutation, EmptySubscription, RootNode,
65
};
76

87
fn query_type_name(b: &mut Bencher) {

juniper/src/executor/look_ahead.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,9 @@ impl<'a, S> LookAheadSelection<'a, S> {
574574
///
575575
/// [arguments]: https://spec.graphql.org/October2021#sec-Language.Arguments
576576
/// [selection]: https://spec.graphql.org/October2021#sec-Selection-Sets
577-
pub fn arguments(&self) -> impl DoubleEndedIterator<Item = LookAheadArgument<'a, S>> {
577+
pub fn arguments(
578+
&self,
579+
) -> impl DoubleEndedIterator<Item = LookAheadArgument<'a, S>> + use<'a, S> {
578580
let opt_arguments = match self.source {
579581
SelectionSource::Field(f) => f.arguments.as_ref(),
580582
_ => None,

juniper/src/executor/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use fnv::FnvHashMap;
1212
use futures::Stream;
1313

1414
use crate::{
15+
GraphQLError,
1516
ast::{
1617
Definition, Document, Fragment, FromInputValue, InputValue, Operation, OperationType,
1718
Selection, ToInputValue, Type,
@@ -32,7 +33,6 @@ use crate::{
3233
subscriptions::{GraphQLSubscriptionType, GraphQLSubscriptionValue},
3334
},
3435
value::{DefaultScalarValue, ParseScalarValue, ScalarValue, Value},
35-
GraphQLError,
3636
};
3737

3838
pub use self::{
@@ -701,7 +701,7 @@ where
701701
// Search the parent's fields to find this field within the selection set.
702702
p.iter().find_map(|x| {
703703
match x {
704-
Selection::Field(ref field) => {
704+
Selection::Field(field) => {
705705
let field = &field.item;
706706
// TODO: support excludes.
707707
let name = field.name.item;

juniper/src/executor/owned_executor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use std::{
44
};
55

66
use crate::{
7+
ExecutionError, Executor, Selection, Variables,
78
ast::Fragment,
89
executor::FieldPath,
910
parser::SourcePosition,
1011
schema::model::{SchemaType, TypeType},
11-
ExecutionError, Executor, Selection, Variables,
1212
};
1313

1414
/// [`Executor`] owning all its variables. Can be used after [`Executor`] was

juniper/src/executor_tests/async_await/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{
2-
graphql_object, graphql_value, graphql_vars, EmptyMutation, EmptySubscription, GraphQLEnum,
3-
RootNode, Value,
2+
EmptyMutation, EmptySubscription, GraphQLEnum, RootNode, Value, graphql_object, graphql_value,
3+
graphql_vars,
44
};
55

66
#[derive(GraphQLEnum)]

juniper/src/executor_tests/enums.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
use crate::{
2+
GraphQLEnum,
3+
GraphQLError::ValidationError,
24
executor::Variables,
35
graphql_value, graphql_vars,
46
parser::SourcePosition,
57
schema::model::RootNode,
68
types::scalars::{EmptyMutation, EmptySubscription},
79
validation::RuleError,
810
value::{DefaultScalarValue, Object},
9-
GraphQLEnum,
10-
GraphQLError::ValidationError,
1111
};
1212

1313
#[derive(GraphQLEnum, Debug)]

0 commit comments

Comments
 (0)