Skip to content

Commit

Permalink
fix: Use std::default for deriving (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Dec 13, 2021
1 parent c5c8e31 commit 03720f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
12 changes: 2 additions & 10 deletions core/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,19 @@

use super::syntax::SyntaxDetails;
use serde::{Deserialize, Serialize};
use std::default::Default;

const ROLE_ACCOUNTS: &str = include_str!("./util/roles.json");

/// Miscelleanous details about the email address.
#[derive(Debug, Deserialize, Serialize)]
#[derive(Debug, Default, Deserialize, Serialize)]
pub struct MiscDetails {
/// Is this a DEA (disposable email account)?
pub is_disposable: bool,
/// Is this email a role-based account?
pub is_role_account: bool,
}

impl Default for MiscDetails {
fn default() -> Self {
MiscDetails {
is_disposable: false,
is_role_account: false,
}
}
}

/// Error occured connecting to this email server via SMTP. Right now this
/// enum has no variant, as `check_misc` cannot fail. But putting a placeholder
/// right now to avoid future breaking changes.
Expand Down
15 changes: 2 additions & 13 deletions core/src/smtp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ use fast_socks5::{
use rand::rngs::SmallRng;
use rand::{distributions::Alphanumeric, Rng, SeedableRng};
use serde::{Deserialize, Serialize};
use std::default::Default;
use std::iter;
use std::str::FromStr;
use std::time::Duration;
use trust_dns_proto::rr::Name;
use yahoo::YahooError;

/// Details that we gathered from connecting to this email via SMTP
#[derive(Debug, Deserialize, Serialize)]
#[derive(Debug, Default, Deserialize, Serialize)]
pub struct SmtpDetails {
/// Are we able to connect to the SMTP server?
pub can_connect_smtp: bool,
Expand All @@ -55,18 +56,6 @@ pub struct SmtpDetails {
pub is_disabled: bool,
}

impl Default for SmtpDetails {
fn default() -> Self {
SmtpDetails {
can_connect_smtp: false,
has_full_inbox: false,
is_catch_all: false,
is_deliverable: false,
is_disabled: false,
}
}
}

/// Error occured connecting to this email server via SMTP.
#[derive(Debug, Serialize)]
#[serde(tag = "type", content = "message")]
Expand Down

0 comments on commit 03720f0

Please sign in to comment.