Make clippy happy

This commit is contained in:
Nicholas Rempel 2021-10-27 16:00:37 -07:00 committed by masalachai
parent 42892e12a0
commit c5fc82491b
10 changed files with 26 additions and 22 deletions

View File

@ -31,22 +31,20 @@
//! ```rust
//! use epp_client::config::CONFIG;
//!
//! fn main() {
//! // Get configuration for the relevant registry section
//! let registry = CONFIG.registry("verisign").unwrap();
//! // Get configuration for the relevant registry section
//! let registry = CONFIG.registry("verisign").unwrap();
//!
//! // Get EPP host name and port no.
//! let remote = registry.connection_details();
//! // Get EPP host name and port no.
//! let remote = registry.connection_details();
//!
//! // Get username and password
//! let credentials = registry.credentials();
//! // Get username and password
//! let credentials = registry.credentials();
//!
//! // Get EPP service extensions
//! let service_extensions = registry.ext_uris().unwrap();
//! // Get EPP service extensions
//! let service_extensions = registry.ext_uris().unwrap();
//!
//! // Get client certificate and private key
//! let tls = registry.tls_files().unwrap();
//! }
//! // Get client certificate and private key
//! let tls = registry.tls_files().unwrap();
//! ```
use confy;

View File

@ -198,6 +198,6 @@ impl EppClient {
impl Drop for EppClient {
fn drop(&mut self) {
block_on(self.logout());
let _ = block_on(self.logout());
}
}

View File

@ -48,7 +48,7 @@ impl EppConnection {
}
/// Writes to the socket
async fn write(&mut self, buf: &Vec<u8>) -> Result<(), Box<dyn Error>> {
async fn write(&mut self, buf: &[u8]) -> Result<(), Box<dyn Error>> {
let wrote = self.stream.writer.write(buf).await?;
debug!("{}: Wrote {} bytes", self.registry, wrote);
@ -139,7 +139,7 @@ impl EppConnection {
impl Drop for EppConnection {
fn drop(&mut self) {
block_on(self.close());
let _ = block_on(self.close());
}
}

View File

@ -212,7 +212,7 @@ impl Address {
) -> Address {
let street = street
.iter()
.filter_map(|s| Some(s.to_string_value()))
.map(|s| s.to_string_value())
.collect::<Vec<StringValue>>();
Address {

View File

@ -97,6 +97,12 @@ impl EppHello {
}
}
impl Default for EppHello {
fn default() -> Self {
Self::new()
}
}
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
#[element_name(name = "login")]
/// Type corresponding to the &lt;login&gt; tag in an EPP XML login request

View File

@ -63,7 +63,7 @@ impl EppContactCheck {
pub fn new(contact_ids: Vec<&str>, client_tr_id: &str) -> EppContactCheck {
let contact_ids = contact_ids
.iter()
.filter_map(|d| Some(d.to_string_value()))
.map(|d| d.to_string_value())
.collect::<Vec<StringValue>>();
let contact_check = ContactCheck {

View File

@ -124,9 +124,8 @@ impl EppContactUpdate {
/// Sets the data for the &lt;fax&gt; tag under &lt;chg&gt; for the contact update request
pub fn set_fax(&mut self, fax: Phone) {
match &mut self.data.command.contact.change_info {
Some(ref mut info) => info.fax = Some(fax),
_ => (),
if let Some(info) = &mut self.data.command.contact.change_info {
info.fax = Some(fax)
}
}

View File

@ -63,7 +63,7 @@ impl EppDomainCheck {
pub fn new(domains: Vec<&str>, client_tr_id: &str) -> EppDomainCheck {
let domains = domains
.iter()
.filter_map(|d| Some(d.to_string_value()))
.map(|d| d.to_string_value())
.collect::<Vec<StringValue>>();
let domain_check = DomainCheck {

View File

@ -116,6 +116,7 @@ pub struct RgpRestoreReport {
impl EppDomainRgpRestoreReport {
/// Creates a new EppObject for domain rgp restore report corresponding to the &lt;epp&gt; tag in EPP XML
#[allow(clippy::too_many_arguments)]
pub fn new(
name: &str,
pre_data: &str,

View File

@ -63,7 +63,7 @@ impl EppHostCheck {
pub fn new(hosts: Vec<&str>, client_tr_id: &str) -> EppHostCheck {
let hosts = hosts
.iter()
.filter_map(|d| Some(d.to_string_value()))
.map(|d| d.to_string_value())
.collect::<Vec<StringValue>>();
let host_check = HostCheck {