Skip to content

Commit 185807f

Browse files
committed
warnings: clean up dead_code warnings
Now that we don't actually generate dead code, we can disable the `allow(dead_code)` attributes and fix the warnings.
1 parent 1e941ed commit 185807f

File tree

13 files changed

+9
-30
lines changed

13 files changed

+9
-30
lines changed
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//! We define the custom scalars present in the GitHub schema. More precise types could be provided here (see tests), as long as they are deserializable.
1+
//! We define the custom scalars present in the GitHub query. More precise types could be provided here (see tests), as long as they are deserializable.
22
3-
pub type X509Certificate = String;
43
pub type URI = String;
5-
pub type HTML = String;
6-
pub type GitTimestamp = String;
7-
pub type GitSSHRemote = String;
8-
pub type GitObjectID = String;
9-
pub type Date = String;
10-
pub type DateTime = String;

examples/github/src/main.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,7 @@ extern crate prettytable;
2020
use graphql_client::*;
2121
use structopt::StructOpt;
2222

23-
type X509Certificate = String;
2423
type URI = String;
25-
type HTML = String;
26-
type GitTimestamp = String;
27-
type GitSSHRemote = String;
28-
type GitObjectID = String;
29-
type Date = String;
30-
type DateTime = String;
3124

3225
#[derive(GraphQLQuery)]
3326
#[graphql(

examples/github/src/query_1.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
query RepoView($owner: String!, $name: String!) {
22
repository(owner: $owner, name: $name) {
3+
homepageUrl
34
stargazers {
45
totalCount
56
}

graphql_client_codegen/src/codegen.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,13 @@ pub fn response_for_query(
149149
let response_derives = context.response_derives();
150150

151151
Ok(quote! {
152+
#[allow(dead_code)]
152153
type Boolean = bool;
154+
#[allow(dead_code)]
153155
type Float = f64;
156+
#[allow(dead_code)]
154157
type Int = i64;
158+
#[allow(dead_code)]
155159
type ID = String;
156160

157161
#(#scalar_definitions)*

tests/custom_scalars.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ type NetworkAddress = Ipv4Addr;
1616
query_path = "tests/custom_scalars/query.graphql",
1717
schema_path = "tests/custom_scalars/schema.graphql"
1818
)]
19-
#[allow(dead_code)]
2019
struct CustomScalarsQuery;
2120

2221
#[test]

tests/deprecation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ extern crate serde_derive;
1010
query_path = "tests/deprecation/query.graphql",
1111
deprecated = "allow",
1212
)]
13-
#[allow(unused_variables, dead_code)]
13+
#[allow(unused_variables)]
1414
struct AllowDeprecation;
1515

1616
#[derive(GraphQLQuery)]
@@ -19,7 +19,7 @@ struct AllowDeprecation;
1919
query_path = "tests/deprecation/query.graphql",
2020
deprecated = "deny",
2121
)]
22-
#[allow(unused_variables, dead_code)]
22+
#[allow(unused_variables)]
2323
struct DenyDeprecation;
2424

2525
#[derive(GraphQLQuery)]
@@ -28,7 +28,7 @@ struct DenyDeprecation;
2828
query_path = "tests/deprecation/query.graphql",
2929
deprecated = "warn",
3030
)]
31-
#[allow(unused_variables, dead_code)]
31+
#[allow(unused_variables)]
3232
struct WarnDeprecation;
3333

3434
#[test]

tests/input_object_variables.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ extern crate serde_json;
1111
schema_path = "tests/input_object_variables/input_object_variables_schema.graphql",
1212
response_derives = "Debug",
1313
)]
14-
#[allow(dead_code)]
1514
struct InputObjectVariablesQuery;
1615

1716
#[test]
@@ -37,7 +36,6 @@ type Email = String;
3736
schema_path = "tests/input_object_variables/input_object_variables_schema.graphql",
3837
response_derives = "Debug",
3938
)]
40-
#[allow(dead_code)]
4139
struct DefaultInputObjectVariablesQuery;
4240

4341
#[test]

tests/interfaces.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const RESPONSE: &'static str = include_str!("interfaces/interface_response.json"
1313
schema_path = "tests/interfaces/interface_schema.graphql",
1414
response_derives = "Debug, PartialEq",
1515
)]
16-
#[allow(dead_code)]
1716
struct InterfaceQuery;
1817

1918
#[test]
@@ -61,7 +60,6 @@ fn interface_deserialization() {
6160
schema_path = "tests/interfaces/interface_schema.graphql",
6261
response_derives = "Debug",
6362
)]
64-
#[allow(dead_code)]
6563
struct InterfaceNotOnEverythingQuery;
6664

6765
const RESPONSE_NOT_ON_EVERYTHING: &'static str =

tests/introspection.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ extern crate serde_json;
1111
schema_path = "tests/introspection/introspection_schema.graphql",
1212
response_derives = "Debug,PartialEq"
1313
)]
14-
#[allow(dead_code)]
1514
struct IntrospectionQuery;
1615

1716
#[test]

tests/operation_selection.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ extern crate serde_json;
1111
schema_path = "tests/operation_selection/schema.graphql",
1212
response_derives = "Debug",
1313
)]
14-
#[allow(dead_code)]
1514
struct Heights;
1615

1716
#[derive(GraphQLQuery)]
@@ -20,7 +19,6 @@ struct Heights;
2019
schema_path = "tests/operation_selection/schema.graphql",
2120
response_derives = "Debug",
2221
)]
23-
#[allow(dead_code)]
2422
struct Echo;
2523

2624
const HEIGHTS_RESPONSE: &'static str = r##"{"mountainHeight": 224, "buildingHeight": 12}"##;

0 commit comments

Comments
 (0)