Remove unused type Variant

This commit is contained in:
Aymeric Beringer
2019-10-11 16:34:23 +02:00
parent 353d0c07d4
commit a9c218d131
2 changed files with 2 additions and 27 deletions

View File

@@ -4,34 +4,10 @@ mod ser;
pub(crate) mod attr;
use syn::{
parse_macro_input, DeriveInput, Error, Data, Ident, Result,
parse_macro_input, DeriveInput, Error, Data,
};
use std::convert::From;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
#[derive(Debug)]
pub(crate) struct Variant {
ident: Ident,
name: Option<String>,
}
impl From<&syn::Variant> for Variant {
fn from(v: &syn::Variant) -> Self {
let ident = v.ident.clone();
Variant {
ident,
name: None,
}
}
}
#[derive(Debug)]
enum TagType {
External,

View File

@@ -3,7 +3,7 @@ use syn::{
DeriveInput, Result, DataEnum, Error, Fields, FieldsNamed,
};
use quote::quote;
use crate::{Variant, TagType};
use crate::TagType;
use crate::attr;
pub fn derive(input: &DeriveInput, enumeration: &DataEnum) -> Result<TokenStream> {
@@ -14,7 +14,6 @@ pub fn derive(input: &DeriveInput, enumeration: &DataEnum) -> Result<TokenStream
));
}
let ident = &input.ident;
let variants: Vec<Variant> = enumeration.variants.iter().map(Into::into).collect();
let tag_type = attr::tag_type(&input.attrs, &enumeration)?;
let names = enumeration.variants
.iter()