Skip to content

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

chore: Run clippy (#77)

Amaury Martiny66f7d7677dbd
diff --git a/core/src/lib.rs b/core/src/lib.rs
index 3f85413a..325ef47d 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -80,9 +80,9 @@ impl Serialize for SingleEmail {
/// The main function: checks email format, checks MX records, and checks SMTP
/// responses to the email inbox.
pub fn email_exists(to_email: &str, from_email: &str) -> SingleEmail {
- let from_email = EmailAddress::from_str(from_email).unwrap_or(
- EmailAddress::from_str("[email protected]").expect("This is a valid email. qed."),
- );
+ let from_email = EmailAddress::from_str(from_email).unwrap_or_else(|_| {
+ EmailAddress::from_str("[email protected]").expect("This is a valid email. qed.")
+ });
debug!("Checking email '{}'", to_email);
let my_syntax = match address_syntax(to_email) {
diff --git a/core/src/syntax.rs b/core/src/syntax.rs
index 25079b33..89151f47 100644
--- a/core/src/syntax.rs
+++ b/core/src/syntax.rs
@@ -61,7 +61,7 @@ pub fn address_syntax(email_address: &str) -> Result<SyntaxDetails, SyntaxError>
};
let iter: &str = email_address.as_ref();
- let mut iter = iter.split("@");
+ let mut iter = iter.split('@');
let username = iter
.next()
.expect("We checked above that email is valid. qed.")