forked from serde-rs/serde
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
#[allow(deprecated)]
to derive implementations
Allow deprecated in the `Serialize`/`Deserialize` derive implementations. This allows you to deprecate structs, enums, struct fields, or enum variants and not get compiler warnings/errors about use of deprecated thing. Resolves serde-rs#2195
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#![deny(deprecated)] | ||
#![allow(dead_code)] | ||
|
||
use serde_derive::{Deserialize, Serialize}; | ||
|
||
/// deprecated enum | ||
#[derive(Serialize, Deserialize)] | ||
#[deprecated] | ||
enum E1 { | ||
A, | ||
B, | ||
} | ||
|
||
/// deprecated struct | ||
#[derive(Serialize, Deserialize)] | ||
#[deprecated] | ||
struct S1 { | ||
a: bool, | ||
} | ||
|
||
/// deprecated enum variant | ||
#[derive(Serialize, Deserialize)] | ||
enum E2 { | ||
A, | ||
#[deprecated] | ||
B, | ||
} | ||
|
||
/// deprecated struct field | ||
#[derive(Serialize, Deserialize)] | ||
#[deprecated] | ||
struct S2 { | ||
#[deprecated] | ||
a: bool, | ||
} |