Skip to content

Check if an email address exists without sending any email, written in Rust. Comes with a ⚙️ HTTP backend.

fix: Use std::default for deriving (#1015)

Amaury03720f027fd6
diff --git a/core/src/misc.rs b/core/src/misc.rs
index de718f91..1b545821 100644
--- a/core/src/misc.rs
+++ b/core/src/misc.rs
@@ -16,11 +16,12 @@
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,
@@ -28,15 +29,6 @@ pub struct MiscDetails {
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.
diff --git a/core/src/smtp/mod.rs b/core/src/smtp/mod.rs
index 1dd3a44a..56d0c847 100644
--- a/core/src/smtp/mod.rs
+++ b/core/src/smtp/mod.rs
@@ -34,6 +34,7 @@ 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;
@@ -41,7 +42,7 @@ 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,
@@ -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")]