From b0595511e43a3092a239dbf4ef6f4c2c26d84c33 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 14 Dec 2021 09:50:33 +0100 Subject: [PATCH] Remove unnecessary Deserialize/Serialize derives --- src/contact/create.rs | 7 ++---- src/domain.rs | 8 +++--- src/hello.rs | 58 +++++++++++++++++++++---------------------- src/login.rs | 4 +-- src/message/ack.rs | 4 +-- 5 files changed, 39 insertions(+), 42 deletions(-) diff --git a/src/contact/create.rs b/src/contact/create.rs index d38ebcf..48aab7b 100644 --- a/src/contact/create.rs +++ b/src/contact/create.rs @@ -78,11 +78,8 @@ impl ContactCreate { // Response /// Type that represents the <creData> tag for contact create response -#[derive(Serialize, Deserialize, Debug)] +#[derive(Deserialize, Debug)] pub struct ContactCreateData { - /// XML namespace for contact response data - #[serde(rename = "xmlns:contact")] - xmlns: String, /// The contact id pub id: StringValue, #[serde(rename = "crDate")] @@ -91,7 +88,7 @@ pub struct ContactCreateData { } /// Type that represents the <resData> tag for contact create response -#[derive(Serialize, Deserialize, Debug)] +#[derive(Deserialize, Debug)] pub struct ContactCreateResponse { /// Data under the <creData> tag #[serde(rename = "creData")] diff --git a/src/domain.rs b/src/domain.rs index f5a9968..5ff14f1 100644 --- a/src/domain.rs +++ b/src/domain.rs @@ -24,7 +24,7 @@ pub struct HostAttr { } /// The list of <hostAttr> types for domain transactions. Typically under an <ns> tag -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Debug)] pub struct HostAttrList { /// The list of <hostAttr> tags #[serde(rename = "domain:hostAttr", alias = "hostAttr")] @@ -32,7 +32,7 @@ pub struct HostAttrList { } /// The list of <hostObj> types for domain transactions. Typically under an <ns> tag -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Debug)] pub struct HostObjList { /// The list of <hostObj> tags #[serde(rename = "domain:hostObj", alias = "hostObj")] @@ -41,7 +41,7 @@ pub struct HostObjList { /// Enum that can accept one type which corresponds to either the <hostObj> or <hostAttr> /// list of tags -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Debug)] #[serde(untagged)] pub enum HostList { HostObjList(HostObjList), @@ -60,7 +60,7 @@ pub struct DomainContact { } /// The <period> type for registration, renewal or transfer on domain transactions -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Debug)] pub struct Period { /// The interval (usually 'y' indicating years) unit: String, diff --git a/src/hello.rs b/src/hello.rs index bf87e65..723d177 100644 --- a/src/hello.rs +++ b/src/hello.rs @@ -31,14 +31,14 @@ impl EppXml for HelloDocument {} // Response /// Type for data within the section of an EPP greeting -#[derive(Serialize, Debug, PartialEq)] +#[derive(Debug, PartialEq)] pub struct ServiceMenu { pub options: Options, pub services: Services, } /// Simplified service menu type for deserialization to `ServiceMenu` type from EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] struct FlattenedServiceMenu { pub version: StringValue, pub lang: StringValue, @@ -72,31 +72,31 @@ impl<'de> Deserialize<'de> for ServiceMenu { } /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct All; /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct NoAccess; /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Null; /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Personal; /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct PersonalAndOther; /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Other; /// Type corresponding to possible type values -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub enum AccessType { /// Data for the tag #[serde(rename = "all")] @@ -119,14 +119,14 @@ pub enum AccessType { } /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Access { #[serde(flatten)] pub ty: AccessType, } /// Type corresponding to possible type values -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub enum PurposeType { /// Data for the tag #[serde(rename = "admin")] @@ -143,14 +143,14 @@ pub enum PurposeType { } /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Purpose { #[serde(rename = "$value")] pub purpose: Vec, } /// Type corresponding to possible type values -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub enum RecipientType { /// Data for the tag #[serde(rename = "other")] @@ -170,34 +170,34 @@ pub enum RecipientType { } /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Recipient { #[serde(rename = "$value")] pub recipient: Vec, } /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Business; /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Indefinite; /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Legal; /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct No; /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Stated; /// Type corresponding to possible type values -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub enum RetentionType { /// Data for the tag #[serde(rename = "business")] @@ -217,14 +217,14 @@ pub enum RetentionType { } /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Retention { #[serde(flatten)] pub ty: RetentionType, } /// Type corresponding to in the EPP greeting XML (pending more compliant implementation) -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Statement { /// Data for the tag pub purpose: Purpose, @@ -235,21 +235,21 @@ pub struct Statement { } /// Type corresponding to value in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Absolute { #[serde(rename = "$value")] pub absolute: StringValue, } /// Type corresponding to value in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Relative { #[serde(rename = "$value")] pub relative: StringValue, } /// Type corresponding to possible type values -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub enum ExpiryType { /// Data for the tag #[serde(rename = "absolute")] @@ -260,14 +260,14 @@ pub enum ExpiryType { } /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Expiry { #[serde(flatten)] pub ty: ExpiryType, } /// Type corresponding to in the EPP greeting XML -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] pub struct Dcp { /// Data for the tag pub access: Access, @@ -277,7 +277,7 @@ pub struct Dcp { pub expiry: Option, } -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] #[serde(rename_all = "lowercase")] /// Type corresponding to the tag in the EPP greeting XML pub struct Greeting { @@ -294,7 +294,7 @@ pub struct Greeting { pub dcp: Dcp, } -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq)] #[serde(rename = "epp")] pub struct GreetingDocument { #[serde(rename = "greeting")] diff --git a/src/login.rs b/src/login.rs index 6c7e2fa..ab2e4c6 100644 --- a/src/login.rs +++ b/src/login.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use serde::{Deserialize, Serialize}; +use serde::Serialize; use crate::{ common::{NoExtension, Options, ServiceExtension, Services, StringValue}, @@ -10,7 +10,7 @@ use crate::{ impl Transaction for Login {} -#[derive(Serialize, Deserialize, Debug, PartialEq)] +#[derive(Serialize, Debug, PartialEq)] /// Type corresponding to the <login> tag in an EPP XML login request pub struct Login { /// The username to use for the login diff --git a/src/message/ack.rs b/src/message/ack.rs index f692210..624ece8 100644 --- a/src/message/ack.rs +++ b/src/message/ack.rs @@ -2,7 +2,7 @@ use crate::common::NoExtension; use crate::request::{Command, Transaction}; -use serde::{Deserialize, Serialize}; +use serde::Serialize; impl Transaction for MessageAck {} @@ -11,7 +11,7 @@ impl Command for MessageAck { const COMMAND: &'static str = "poll"; } -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Debug)] /// Type for EPP XML <poll> command for message ack pub struct MessageAck { /// The type of operation to perform