Skip to content

Commit 0e2c7e5

Browse files
committed
Complete migration to 2018 edition and removal of skeptic
1 parent d15796b commit 0e2c7e5

File tree

7 files changed

+28
-24
lines changed

7 files changed

+28
-24
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ script:
2323
- if [ "$TRAVIS_RUST_VERSION" = "stable" ]; then (cargo clippy -- -D warnings) fi
2424
- if [ "$TRAVIS_RUST_VERSION" = "beta" ]; then (prettier --debug-check -l './**/*.json' './**/*.graphql') fi
2525
- cargo test --all
26-
# - cargo build --manifest-path=./examples/github/Cargo.toml
27-
# - cargo build --manifest-path=./examples/web/Cargo.toml
26+
- cargo build --manifest-path=./examples/github/Cargo.toml
27+
- cargo build --manifest-path=./examples/web/Cargo.toml
2828
- if [ "$TRAVIS_RUST_VERSION" = "stable" ]; then (xvfb-run cargo test --manifest-path=./graphql_client_web/Cargo.toml --target wasm32-unknown-unknown) fi

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ A typed GraphQL client library for Rust.
3434
- We now have everything we need to derive Rust types for our query. This is achieved through a procedural macro, as in the following snippet:
3535

3636
```rust
37-
use serde::{Serialize, Deserialize};
3837
use graphql_client::GraphQLQuery;
3938

4039
// The paths are relative to the directory where your `Cargo.toml` is located.
@@ -142,7 +141,6 @@ use graphql_client::GraphQLQuery;
142141
#[graphql(
143142
schema_path = "tests/unions/union_schema.graphql",
144143
query_path = "tests/unions/union_query.graphql",
145-
selected_operation = "SearchQuery"
146144
)]
147145
pub struct UnionQuery;
148146
```

graphql_client/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ edition = "2018"
1111

1212
[dependencies]
1313
failure = "0.1"
14-
graphql_query_derive = {path = "../graphql_query_derive", version = "0.7.1" }
14+
graphql_query_derive = { path = "../graphql_query_derive", version = "0.7.1" }
1515
serde = { version = "^1.0.78", features = ["derive"] }
1616
serde_json = "1.0"
17+
doc-comment = "0.3.1"
18+
19+
[dev-dependencies]
20+
reqwest = "*"

graphql_client/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
#![deny(missing_docs)]
77
#![deny(rust_2018_idioms)]
88

9-
pub use graphql_query_derive;
9+
#[allow(unused_imports)]
10+
#[macro_use]
11+
extern crate graphql_query_derive;
12+
13+
#[doc(hidden)]
14+
pub use graphql_query_derive::*;
15+
1016
use serde::*;
1117

1218
#[cfg(test)]
@@ -18,6 +24,8 @@ pub use graphql_query_derive::*;
1824
use std::collections::HashMap;
1925
use std::fmt::{self, Display};
2026

27+
doc_comment::doctest!("../../README.md");
28+
2129
/// A convenience trait that can be used to build a GraphQL request body.
2230
///
2331
/// This will be implemented for you by codegen in the normal case. It is implemented on the struct you place the derive on.

graphql_client_cli/src/introspect_schema.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use failure;
1+
use failure::format_err;
22
use graphql_client::GraphQLQuery;
3-
use reqwest;
43
use reqwest::header::{HeaderMap, HeaderValue, ACCEPT, CONTENT_TYPE};
5-
use serde_json;
64
use std::path::PathBuf;
75
use std::str::FromStr;
86

graphql_client_codegen/src/generated_module.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,27 @@ impl<'a> GeneratedModule<'a> {
5555
#struct_declaration
5656

5757
#module_visibility mod #module_name {
58-
#![allow(non_camel_case_types)]
59-
#![allow(non_snake_case)]
6058
#![allow(dead_code)]
6159

62-
use serde;
63-
6460
pub const OPERATION_NAME: &'static str = #operation_name_literal;
6561
pub const QUERY: &'static str = #query_string;
6662

6763
#query_include
6864

6965
#impls
66+
}
7067

71-
impl ::graphql_client::GraphQLQuery for super::#operation_name_ident {
72-
type Variables = Variables;
73-
type ResponseData = ResponseData;
74-
75-
fn build_query(variables: Self::Variables) -> ::graphql_client::QueryBody<Self::Variables> {
76-
::graphql_client::QueryBody {
77-
variables,
78-
query: QUERY,
79-
operation_name: OPERATION_NAME,
80-
}
68+
impl graphql_client::GraphQLQuery for #operation_name_ident {
69+
type Variables = #module_name::Variables;
70+
type ResponseData = #module_name::ResponseData;
8171

72+
fn build_query(variables: Self::Variables) -> ::graphql_client::QueryBody<Self::Variables> {
73+
graphql_client::QueryBody {
74+
variables,
75+
query: #module_name::QUERY,
76+
operation_name: #module_name::OPERATION_NAME,
8277
}
78+
8379
}
8480
}
8581
))

graphql_query_derive/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::path::{Path, PathBuf};
1212
use proc_macro2::TokenStream;
1313

1414
#[proc_macro_derive(GraphQLQuery, attributes(graphql))]
15-
pub fn graphql_query_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
15+
pub fn derive_graphql_query(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
1616
match graphql_query_derive_inner(input) {
1717
Ok(ts) => ts,
1818
Err(err) => panic!(

0 commit comments

Comments
 (0)