Skip to content

Commit 8af2434

Browse files
committed
Use a default for DeprecationStrategy
This makes it so we can change it in one place in the future.
1 parent 34e69d2 commit 8af2434

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

graphql_client_codegen/src/deprecation.rs

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

20+
impl Default for DeprecationStrategy {
21+
fn default() -> Self { DeprecationStrategy::Warn }
22+
}
23+
2024
pub fn extract_deprecation_strategy(
2125
ast: &syn::DeriveInput,
2226
) -> Result<DeprecationStrategy, failure::Error> {

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)