Apply clippy suggestions

This commit is contained in:
Dirkjan Ochtman 2022-11-21 11:41:28 -08:00 committed by masalachai
parent 698bab9b2b
commit a34dbdcf82
8 changed files with 50 additions and 50 deletions

View File

@ -12,7 +12,7 @@ pub(crate) const EPP_XMLNS: &str = "urn:ietf:params:xml:ns:epp-1.0";
/// Wraps String for easier serialization to and from values that are inner text /// Wraps String for easier serialization to and from values that are inner text
/// for tags rather than attributes /// for tags rather than attributes
#[derive(Default, Serialize, Deserialize, Debug, PartialEq, Clone)] #[derive(Default, Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
pub struct StringValue<'a>(Cow<'a, str>); pub struct StringValue<'a>(Cow<'a, str>);
impl Deref for StringValue<'_> { impl Deref for StringValue<'_> {
@ -47,7 +47,7 @@ impl From<String> for StringValue<'static> {
} }
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
/// An empty placeholder tag. To be refactored to something more compliant later. /// An empty placeholder tag. To be refactored to something more compliant later.
pub struct NoExtension; pub struct NoExtension;
@ -123,7 +123,7 @@ impl From<DeserializedCheckResponse> for CheckResponse {
} }
/// The <option> type in EPP XML login requests /// The <option> type in EPP XML login requests
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
#[serde(rename = "options")] #[serde(rename = "options")]
pub struct Options<'a> { pub struct Options<'a> {
/// The EPP version being used /// The EPP version being used
@ -143,7 +143,7 @@ impl<'a> Options<'a> {
} }
/// The <svcExtension> type in EPP XML /// The <svcExtension> type in EPP XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
#[serde(rename = "svcExtension")] #[serde(rename = "svcExtension")]
pub struct ServiceExtension<'a> { pub struct ServiceExtension<'a> {
/// The service extension URIs being represented by <extURI> in EPP XML /// The service extension URIs being represented by <extURI> in EPP XML
@ -152,7 +152,7 @@ pub struct ServiceExtension<'a> {
} }
/// The <svcs> type in EPP XML /// The <svcs> type in EPP XML
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
pub struct Services<'a> { pub struct Services<'a> {
/// The service URIs being used by this EPP session represented by <objURI> in EPP XML /// The service URIs being used by this EPP session represented by <objURI> in EPP XML
#[serde(rename = "objURI")] #[serde(rename = "objURI")]

View File

@ -171,7 +171,7 @@ mod tests {
result.info_data.updated_at, result.info_data.updated_at,
Utc.with_ymd_and_hms(2021, 7, 23, 13, 9, 9).single() Utc.with_ymd_and_hms(2021, 7, 23, 13, 9, 9).single()
); );
assert_eq!((*auth_info).password, "eppdev-387323".into()); assert_eq!(auth_info.password, "eppdev-387323".into());
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into()); assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into()); assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
} }

View File

@ -150,7 +150,7 @@ mod tests {
let result = object.res_data().unwrap(); let result = object.res_data().unwrap();
let auth_info = result.info_data.auth_info.as_ref().unwrap(); let auth_info = result.info_data.auth_info.as_ref().unwrap();
let ns_list = result.info_data.ns.as_ref().unwrap(); let ns_list = result.info_data.ns.as_ref().unwrap();
let ns = (*ns_list).host_obj.as_ref().unwrap(); let ns = ns_list.host_obj.as_ref().unwrap();
let hosts = result.info_data.hosts.as_ref().unwrap(); let hosts = result.info_data.hosts.as_ref().unwrap();
let statuses = result.info_data.statuses.as_ref().unwrap(); let statuses = result.info_data.statuses.as_ref().unwrap();
let registrant = result.info_data.registrant.as_ref().unwrap(); let registrant = result.info_data.registrant.as_ref().unwrap();
@ -194,7 +194,7 @@ mod tests {
*result.info_data.expiring_at.as_ref().unwrap(), *result.info_data.expiring_at.as_ref().unwrap(),
Utc.with_ymd_and_hms(2023, 7, 23, 15, 31, 20).unwrap() Utc.with_ymd_and_hms(2023, 7, 23, 15, 31, 20).unwrap()
); );
assert_eq!((*auth_info).password, "epP4uthd#v".into()); assert_eq!(auth_info.password, "epP4uthd#v".into());
assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into()); assert_eq!(object.tr_ids.client_tr_id.unwrap(), CLTRID.into());
assert_eq!(object.tr_ids.server_tr_id, SVTRID.into()); assert_eq!(object.tr_ids.server_tr_id, SVTRID.into());
} }

View File

@ -25,7 +25,7 @@ impl Extension for UpdateWithNameStore<'_> {
type Response = NameStore<'static>; type Response = NameStore<'static>;
} }
#[derive(PartialEq, Debug)] #[derive(PartialEq, Eq, Debug)]
pub struct GMonthDay { pub struct GMonthDay {
pub month: u8, pub month: u8,
pub day: u8, pub day: u8,

View File

@ -29,7 +29,7 @@ impl Default for HelloDocument {
// Response // Response
/// Type for data within the <svcMenu> section of an EPP greeting /// Type for data within the <svcMenu> section of an EPP greeting
#[derive(Debug, PartialEq)] #[derive(Debug, Eq, PartialEq)]
pub struct ServiceMenu { pub struct ServiceMenu {
pub options: Options<'static>, pub options: Options<'static>,
pub services: Services<'static>, pub services: Services<'static>,
@ -70,31 +70,31 @@ impl<'a, 'de: 'a> Deserialize<'de> for ServiceMenu {
} }
/// Type corresponding to <all> in the EPP greeting XML /// Type corresponding to <all> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct All; pub struct All;
/// Type corresponding to <none> in the EPP greeting XML /// Type corresponding to <none> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct NoAccess; pub struct NoAccess;
/// Type corresponding to <null> in the EPP greeting XML /// Type corresponding to <null> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Null; pub struct Null;
/// Type corresponding to <personal> in the EPP greeting XML /// Type corresponding to <personal> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Personal; pub struct Personal;
/// Type corresponding to <personalAndOther> in the EPP greeting XML /// Type corresponding to <personalAndOther> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct PersonalAndOther; pub struct PersonalAndOther;
/// Type corresponding to <other> in the EPP greeting XML /// Type corresponding to <other> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Other; pub struct Other;
/// Type corresponding to possible <retention> type values /// Type corresponding to possible <retention> type values
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub enum AccessType { pub enum AccessType {
/// Data for the <all> tag /// Data for the <all> tag
#[serde(rename = "all")] #[serde(rename = "all")]
@ -117,14 +117,14 @@ pub enum AccessType {
} }
/// Type corresponding to <access> in the EPP greeting XML /// Type corresponding to <access> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Access { pub struct Access {
#[serde(flatten)] #[serde(flatten)]
pub ty: AccessType, pub ty: AccessType,
} }
/// Type corresponding to possible <purpose> type values /// Type corresponding to possible <purpose> type values
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub enum PurposeType { pub enum PurposeType {
/// Data for the <admin> tag /// Data for the <admin> tag
#[serde(rename = "admin")] #[serde(rename = "admin")]
@ -141,14 +141,14 @@ pub enum PurposeType {
} }
/// Type corresponding to <purpose> in the EPP greeting XML /// Type corresponding to <purpose> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Purpose { pub struct Purpose {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub purpose: Vec<PurposeType>, pub purpose: Vec<PurposeType>,
} }
/// Type corresponding to possible <purpose> type values /// Type corresponding to possible <purpose> type values
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub enum RecipientType { pub enum RecipientType {
/// Data for the <other> tag /// Data for the <other> tag
#[serde(rename = "other")] #[serde(rename = "other")]
@ -168,34 +168,34 @@ pub enum RecipientType {
} }
/// Type corresponding to <recipeint> in the EPP greeting XML /// Type corresponding to <recipeint> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Recipient { pub struct Recipient {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub recipient: Vec<RecipientType>, pub recipient: Vec<RecipientType>,
} }
/// Type corresponding to <business> in the EPP greeting XML /// Type corresponding to <business> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Business; pub struct Business;
/// Type corresponding to <indefinite> in the EPP greeting XML /// Type corresponding to <indefinite> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Indefinite; pub struct Indefinite;
/// Type corresponding to <legal> in the EPP greeting XML /// Type corresponding to <legal> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Legal; pub struct Legal;
/// Type corresponding to <none> in the EPP greeting XML /// Type corresponding to <none> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct No; pub struct No;
/// Type corresponding to <stated> in the EPP greeting XML /// Type corresponding to <stated> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Stated; pub struct Stated;
/// Type corresponding to possible <retention> type values /// Type corresponding to possible <retention> type values
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub enum RetentionType { pub enum RetentionType {
/// Data for the <business> tag /// Data for the <business> tag
#[serde(rename = "business")] #[serde(rename = "business")]
@ -215,14 +215,14 @@ pub enum RetentionType {
} }
/// Type corresponding to <retention> in the EPP greeting XML /// Type corresponding to <retention> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Retention { pub struct Retention {
#[serde(flatten)] #[serde(flatten)]
pub ty: RetentionType, pub ty: RetentionType,
} }
/// Type corresponding to <statement> in the EPP greeting XML (pending more compliant implementation) /// Type corresponding to <statement> in the EPP greeting XML (pending more compliant implementation)
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Statement { pub struct Statement {
/// Data for the <purpose> tag /// Data for the <purpose> tag
pub purpose: Purpose, pub purpose: Purpose,
@ -233,21 +233,21 @@ pub struct Statement {
} }
/// Type corresponding to <absolute> value in the EPP greeting XML /// Type corresponding to <absolute> value in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Absolute { pub struct Absolute {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub absolute: StringValue<'static>, pub absolute: StringValue<'static>,
} }
/// Type corresponding to <relative> value in the EPP greeting XML /// Type corresponding to <relative> value in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Relative { pub struct Relative {
#[serde(rename = "$value")] #[serde(rename = "$value")]
pub relative: StringValue<'static>, pub relative: StringValue<'static>,
} }
/// Type corresponding to possible <expiry> type values /// Type corresponding to possible <expiry> type values
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub enum ExpiryType { pub enum ExpiryType {
/// Data for the <absolute> tag /// Data for the <absolute> tag
#[serde(rename = "absolute")] #[serde(rename = "absolute")]
@ -258,14 +258,14 @@ pub enum ExpiryType {
} }
/// Type corresponding to <expiry> in the EPP greeting XML /// Type corresponding to <expiry> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Expiry { pub struct Expiry {
#[serde(flatten)] #[serde(flatten)]
pub ty: ExpiryType, pub ty: ExpiryType,
} }
/// Type corresponding to <dcp> in the EPP greeting XML /// Type corresponding to <dcp> in the EPP greeting XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Dcp { pub struct Dcp {
/// Data for the <access> tag /// Data for the <access> tag
pub access: Access, pub access: Access,
@ -275,7 +275,7 @@ pub struct Dcp {
pub expiry: Option<Expiry>, pub expiry: Option<Expiry>,
} }
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
/// Type corresponding to the <greeting> tag in the EPP greeting XML /// Type corresponding to the <greeting> tag in the EPP greeting XML
pub struct Greeting { pub struct Greeting {
@ -292,7 +292,7 @@ pub struct Greeting {
pub dcp: Dcp, pub dcp: Dcp,
} }
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
#[serde(rename = "epp")] #[serde(rename = "epp")]
pub struct GreetingDocument { pub struct GreetingDocument {
#[serde(rename = "greeting")] #[serde(rename = "greeting")]

View File

@ -10,7 +10,7 @@ use crate::{
impl<'a> Transaction<NoExtension> for Login<'a> {} impl<'a> Transaction<NoExtension> for Login<'a> {}
#[derive(Serialize, Debug, PartialEq)] #[derive(Serialize, Debug, Eq, PartialEq)]
/// Type corresponding to the &lt;login&gt; tag in an EPP XML login request /// Type corresponding to the &lt;login&gt; tag in an EPP XML login request
pub struct Login<'a> { pub struct Login<'a> {
/// The username to use for the login /// The username to use for the login

View File

@ -14,7 +14,7 @@ impl Command for Logout {
const COMMAND: &'static str = "logout"; const COMMAND: &'static str = "logout";
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
/// Type corresponding to the &lt;logout&gt; tag in an EPP XML logout request /// Type corresponding to the &lt;logout&gt; tag in an EPP XML logout request
pub struct Logout; pub struct Logout;

View File

@ -8,11 +8,11 @@ use serde::Deserialize;
use crate::common::StringValue; use crate::common::StringValue;
/// Type corresponding to the <undef> tag an EPP response XML /// Type corresponding to the <undef> tag an EPP response XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct Undef; pub struct Undef;
/// Type corresponding to the <value> tag under <extValue> in an EPP response XML /// Type corresponding to the <value> tag under <extValue> in an EPP response XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct ResultValue { pub struct ResultValue {
/// The XML namespace for the <value> tag /// The XML namespace for the <value> tag
#[serde(rename = "xmlns:epp")] #[serde(rename = "xmlns:epp")]
@ -22,7 +22,7 @@ pub struct ResultValue {
} }
/// Type corresponding to the <extValue> tag in an EPP response XML /// Type corresponding to the <extValue> tag in an EPP response XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct ExtValue { pub struct ExtValue {
/// Data under the <value> tag /// Data under the <value> tag
pub value: ResultValue, pub value: ResultValue,
@ -31,7 +31,7 @@ pub struct ExtValue {
} }
/// Type corresponding to the <result> tag in an EPP response XML /// Type corresponding to the <result> tag in an EPP response XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct EppResult { pub struct EppResult {
/// The result code /// The result code
pub code: ResultCode, pub code: ResultCode,
@ -44,7 +44,7 @@ pub struct EppResult {
} }
/// Response codes as enumerated in section 3 of RFC 5730 /// Response codes as enumerated in section 3 of RFC 5730
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ResultCode { pub enum ResultCode {
CommandCompletedSuccessfully = 1000, CommandCompletedSuccessfully = 1000,
CommandCompletedSuccessfullyActionPending = 1001, CommandCompletedSuccessfullyActionPending = 1001,
@ -166,7 +166,7 @@ impl<'de> serde::de::Visitor<'de> for ResultCodeVisitor {
} }
/// Type corresponding to the <trID> tag in an EPP response XML /// Type corresponding to the <trID> tag in an EPP response XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct ResponseTRID { pub struct ResponseTRID {
/// The client TRID /// The client TRID
#[serde(rename = "clTRID")] #[serde(rename = "clTRID")]
@ -177,7 +177,7 @@ pub struct ResponseTRID {
} }
/// Type corresponding to the <msgQ> tag in an EPP response XML /// Type corresponding to the <msgQ> tag in an EPP response XML
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
pub struct MessageQueue { pub struct MessageQueue {
/// The message count /// The message count
pub count: u32, pub count: u32,
@ -191,7 +191,7 @@ pub struct MessageQueue {
pub message: Option<StringValue<'static>>, pub message: Option<StringValue<'static>>,
} }
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
/// Type corresponding to the &lt;response&gt; tag in an EPP response XML /// Type corresponding to the &lt;response&gt; tag in an EPP response XML
/// containing an &lt;extension&gt; tag /// containing an &lt;extension&gt; tag
pub struct Response<D, E> { pub struct Response<D, E> {
@ -210,21 +210,21 @@ pub struct Response<D, E> {
pub tr_ids: ResponseTRID, pub tr_ids: ResponseTRID,
} }
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
#[serde(rename = "epp")] #[serde(rename = "epp")]
pub struct ResponseDocument<D, E> { pub struct ResponseDocument<D, E> {
#[serde(rename = "response")] #[serde(rename = "response")]
pub data: Response<D, E>, pub data: Response<D, E>,
} }
#[derive(Debug, Deserialize, PartialEq)] #[derive(Debug, Deserialize, Eq, PartialEq)]
#[serde(rename = "epp")] #[serde(rename = "epp")]
pub struct ResultDocument { pub struct ResultDocument {
#[serde(rename = "response")] #[serde(rename = "response")]
pub data: ResponseStatus, pub data: ResponseStatus,
} }
#[derive(Deserialize, Debug, PartialEq)] #[derive(Deserialize, Debug, Eq, PartialEq)]
/// Type corresponding to the &lt;response&gt; tag in an EPP response XML /// Type corresponding to the &lt;response&gt; tag in an EPP response XML
/// without <msgQ> or &lt;resData&gt; sections. Generally used for error handling /// without <msgQ> or &lt;resData&gt; sections. Generally used for error handling
pub struct ResponseStatus { pub struct ResponseStatus {