Skip to content

Commit c232d91

Browse files
authored
Merge pull request #148 from LegNeato/default_strategy
Use a default for DeprecationStrategy
2 parents 34e69d2 + 653ec65 commit c232d91

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

graphql_client_codegen/src/deprecation.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ pub enum DeprecationStrategy {
1717
Warn,
1818
}
1919

20+
impl Default for DeprecationStrategy {
21+
fn default() -> Self {
22+
DeprecationStrategy::Warn
23+
}
24+
}
25+
2026
pub fn extract_deprecation_strategy(
2127
ast: &syn::DeriveInput,
2228
) -> Result<DeprecationStrategy, failure::Error> {

graphql_client_codegen/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub fn generate_module_token_stream(
7878
// The user can determine what to do about deprecations.
7979
let deprecation_strategy = options
8080
.deprecation_strategy
81-
.unwrap_or(deprecation::DeprecationStrategy::Warn);
81+
.unwrap_or(deprecation::DeprecationStrategy::default());
8282

8383
// We need to qualify the query with the path to the crate it is part of
8484
let (query_string, query) = {

graphql_query_derive/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn build_graphql_client_derive_options(input: &syn::DeriveInput) -> GraphQLClien
3434
let response_derives = attributes::extract_attr(input, "response_derives").ok();
3535
// The user can determine what to do about deprecations.
3636
let deprecation_strategy = deprecation::extract_deprecation_strategy(input)
37-
.unwrap_or(deprecation::DeprecationStrategy::Warn);
37+
.unwrap_or(deprecation::DeprecationStrategy::default());
3838

3939
GraphQLClientDeriveOptions {
4040
selected_operation: input.ident.to_string(),

0 commit comments

Comments
 (0)