Replace custom_encodable
with encodable
.
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
This commit is contained in:
parent
cc4bb0de20
commit
3ef9d4d0ed
29 changed files with 27 additions and 28 deletions
|
@ -42,6 +42,7 @@ rustc_index::newtype_index! {
|
|||
/// `d` is `FieldIdx(1)` in `VariantIdx(1)`, and
|
||||
/// `f` is `FieldIdx(1)` in `VariantIdx(0)`.
|
||||
#[derive(HashStable_Generic)]
|
||||
#[encodable]
|
||||
pub struct FieldIdx {}
|
||||
}
|
||||
|
||||
|
@ -57,6 +58,7 @@ rustc_index::newtype_index! {
|
|||
/// `struct`s, `tuples`, and `unions`s are considered to have a single variant
|
||||
/// with variant index zero, aka [`FIRST_VARIANT`].
|
||||
#[derive(HashStable_Generic)]
|
||||
#[encodable]
|
||||
pub struct VariantIdx {
|
||||
/// Equivalent to `VariantIdx(0)`.
|
||||
const FIRST_VARIANT = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue