Use derive for default impl of DynamicVariant (#7986)

This commit is contained in:
Rob Parrett 2023-03-08 15:27:54 -07:00 committed by GitHub
parent d3df04cb4c
commit 2908bb5e8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,8 +8,9 @@ use std::any::Any;
use std::fmt::Formatter;
/// A dynamic representation of an enum variant.
#[derive(Debug)]
#[derive(Debug, Default)]
pub enum DynamicVariant {
#[default]
Unit,
Tuple(DynamicTuple),
Struct(DynamicStruct),
@ -25,12 +26,6 @@ impl Clone for DynamicVariant {
}
}
impl Default for DynamicVariant {
fn default() -> Self {
DynamicVariant::Unit
}
}
impl From<DynamicTuple> for DynamicVariant {
fn from(dyn_tuple: DynamicTuple) -> Self {
Self::Tuple(dyn_tuple)