Skip to content

Commit 5805302

Browse files
authored
Merge pull request #190 from h-michael/2018-edition
Rust 2018
2 parents ae6d911 + 3cac104 commit 5805302

29 files changed

+227
-196
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## Unreleased
99

10+
## 0.8.0
11+
12+
This release is only compatible with Rust 1.31.0 and later.
13+
14+
## 0.7.1
15+
1016
### Fixed
1117

1218
- In the CLI, both --selected-operation and --output used the -o shorthand. --output now uses -out.

graphql_client/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
[package]
22
name = "graphql_client"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
authors = ["Tom Houlé <[email protected]>"]
55
description = "Typed GraphQL requests and responses"
66
repository = "https://github.com/graphql-rust/graphql-client"
77
license = "Apache-2.0 OR MIT"
88
keywords = ["graphql", "api", "web", "webassembly", "wasm"]
99
categories = ["network-programming", "web-programming", "wasm"]
10+
edition = "2018"
1011

1112
[dependencies]
1213
failure = "0.1"
13-
graphql_query_derive = {path = "../graphql_query_derive", version = "0.7.0" }
14+
graphql_query_derive = {path = "../graphql_query_derive", version = "0.8.0" }
1415
serde = "^1.0.78"
1516
serde_derive = "1.0"
1617
serde_json = "1.0"
1718

1819
[build-dependencies]
19-
skeptic = "0.13"
20+
skeptic = "0.13.4"
2021

2122
[dev-dependencies]
22-
skeptic = "0.13"
23+
skeptic = "0.13.4"

graphql_client/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#![deny(warnings)]
66
#![deny(missing_docs)]
77

8-
extern crate serde;
8+
use serde;
99
#[macro_use]
1010
extern crate serde_derive;
11-
pub extern crate graphql_query_derive;
11+
pub use graphql_query_derive;
1212

13-
#[cfg_attr(test, macro_use)]
14-
extern crate serde_json;
13+
#[cfg(test)]
14+
use serde_json::json;
1515

1616
#[doc(hidden)]
1717
pub use graphql_query_derive::*;
@@ -111,7 +111,7 @@ pub enum PathFragment {
111111
}
112112

113113
impl Display for PathFragment {
114-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
114+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
115115
match *self {
116116
PathFragment::Key(ref key) => write!(f, "{}", key),
117117
PathFragment::Index(ref idx) => write!(f, "{}", idx),
@@ -200,7 +200,7 @@ pub struct Error {
200200
}
201201

202202
impl Display for Error {
203-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
203+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
204204
// Use `/` as a separator like JSON Pointer.
205205
let path = self
206206
.path

graphql_client/tests/alias.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[macro_use]
22
extern crate graphql_client;
3-
extern crate serde;
3+
44
#[macro_use]
55
extern crate serde_derive;
66
#[macro_use]

graphql_client/tests/scalar_variables.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
extern crate graphql_client;
33
#[macro_use]
44
extern crate serde_derive;
5-
extern crate serde;
6-
extern crate serde_json;
5+
6+
use serde_json;
77

88
#[derive(GraphQLQuery)]
99
#[graphql(

graphql_client/tests/type_refining_fragments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn type_refining_fragment_on_union() {
5252

5353
#[test]
5454
fn type_refining_fragment_on_interface() {
55-
use query_on_interface::*;
55+
use crate::query_on_interface::*;
5656

5757
const RESPONSE: &'static str = include_str!("interfaces/interface_response.json");
5858

graphql_client_cli/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[package]
22
name = "graphql_client_cli"
33
description = "The CLI for graphql-client"
4-
version = "0.7.1"
4+
version = "0.8.0"
55
authors = ["Tom Houlé <[email protected]>"]
66
license = "Apache-2.0 OR MIT"
77
repository = "https://github.com/graphql-rust/graphql-client"
8+
edition = "2018"
89

910
[[bin]]
1011
name = "graphql-client"
@@ -13,8 +14,8 @@ path = "src/main.rs"
1314
[dependencies]
1415
failure = "0.1"
1516
reqwest = "^0.9.0"
16-
graphql_client = { version = "0.7.0", path = "../graphql_client" }
17-
graphql_client_codegen = { path = "../graphql_client_codegen/", version = "0.7.0" }
17+
graphql_client = { version = "0.8.0", path = "../graphql_client" }
18+
graphql_client_codegen = { path = "../graphql_client_codegen/", version = "0.8.0" }
1819
structopt = "0.2"
1920
serde = "1.0"
2021
serde_derive = "1.0"

graphql_client_codegen/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[package]
22
name = "graphql_client_codegen"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
authors = ["Tom Houlé <[email protected]>"]
55
description = "Utility crate for graphql_client"
66
license = "Apache-2.0 OR MIT"
77
repository = "https://github.com/graphql-rust/graphql-client"
8+
edition = "2018"
89

910
[dependencies]
1011
failure = "0.1"

graphql_client_codegen/src/codegen.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
use crate::fragments::GqlFragment;
2+
use crate::operations::Operation;
3+
use crate::query::QueryContext;
4+
use crate::schema;
5+
use crate::selection::Selection;
16
use failure;
2-
use fragments::GqlFragment;
37
use graphql_parser::query;
4-
use operations::Operation;
58
use proc_macro2::TokenStream;
6-
use query::QueryContext;
7-
use schema;
8-
use selection::Selection;
99

1010
/// Selects the first operation matching `struct_name`. Returns `None` when the query document defines no operation, or when the selected operation does not match any defined operation.
1111
pub(crate) fn select_operation<'query>(
@@ -20,8 +20,8 @@ pub(crate) fn select_operation<'query>(
2020
.map(|i| i.to_owned())
2121
}
2222

23-
pub(crate) fn all_operations(query: &query::Document) -> Vec<Operation> {
24-
let mut operations: Vec<Operation> = Vec::new();
23+
pub(crate) fn all_operations(query: &query::Document) -> Vec<Operation<'_>> {
24+
let mut operations: Vec<Operation<'_>> = Vec::new();
2525

2626
for definition in &query.definitions {
2727
if let query::Definition::Operation(op) = definition {
@@ -33,10 +33,10 @@ pub(crate) fn all_operations(query: &query::Document) -> Vec<Operation> {
3333

3434
/// The main code generation function.
3535
pub(crate) fn response_for_query(
36-
schema: &schema::Schema,
36+
schema: &schema::Schema<'_>,
3737
query: &query::Document,
38-
operation: &Operation,
39-
options: &::GraphQLClientCodegenOptions,
38+
operation: &Operation<'_>,
39+
options: &crate::GraphQLClientCodegenOptions,
4040
) -> Result<TokenStream, failure::Error> {
4141
let mut context = QueryContext::new(schema, options.deprecation_strategy());
4242

@@ -88,7 +88,7 @@ pub(crate) fn response_for_query(
8888
if operation.is_subscription() && selection.len() > 1 {
8989
Err(format_err!(
9090
"{}",
91-
::constants::MULTIPLE_SUBSCRIPTION_FIELDS_ERROR
91+
crate::constants::MULTIPLE_SUBSCRIPTION_FIELDS_ERROR
9292
))?
9393
}
9494

graphql_client_codegen/src/constants.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use deprecation::DeprecationStatus;
2-
use field_type::FieldType;
3-
use objects::GqlObjectField;
1+
use crate::deprecation::DeprecationStatus;
2+
use crate::field_type::FieldType;
3+
use crate::objects::GqlObjectField;
44

55
pub(crate) const TYPENAME_FIELD: &str = "__typename";
66

0 commit comments

Comments
 (0)