Remove ClientId::new_domain

This commit is contained in:
Alexis Mousset
2020-08-28 11:13:51 +02:00
committed by Paolo Barbolini
parent 36aab20086
commit 41d68616e0
3 changed files with 5 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ Several breaking changes were made between 0.9 and 0.10, but changes should be s
* Merge `Email` and `SendableEmail` into `lettre::Email` ([ce37464](https://github.com/lettre/lettre/commit/ce37464))
* When the hostname feature is disabled or hostname cannot be fetched, `127.0.0.1` is used instead of `localhost` as
EHLO parameter (for better RFC compliance and mail server compatibility)
* The `new` method of `ClientId` is renamed to `new_domain`
* The `new` method of `ClientId` is deprecated
#### Bug Fixes

View File

@@ -13,6 +13,7 @@ use std::{
/// Client identifier, the parameter to `EHLO`
#[derive(PartialEq, Eq, Clone, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[non_exhaustive]
pub enum ClientId {
/// A fully-qualified domain name
Domain(String),
@@ -57,16 +58,11 @@ impl Display for ClientId {
}
impl ClientId {
#[deprecated(since = "0.10.0", note = "Please use the new_domain function instead")]
#[deprecated(since = "0.10.0", note = "Please use ClientId::Domain(domain) instead")]
/// Creates a new `ClientId` from a fully qualified domain name
pub fn new(domain: String) -> Self {
Self::Domain(domain)
}
/// Creates a new `ClientId` from a fully qualified domain name
pub fn new_domain(domain: String) -> Self {
Self::Domain(domain)
}
}
/// Supported ESMTP keywords
@@ -296,7 +292,7 @@ mod test {
#[test]
fn test_clientid_fmt() {
assert_eq!(
format!("{}", ClientId::new_domain("test".to_string())),
format!("{}", ClientId::Domain("test".to_string())),
"test".to_string()
);
assert_eq!(format!("{}", LOCALHOST_CLIENT), "[127.0.0.1]".to_string());

View File

@@ -162,7 +162,7 @@
//! # {
//! use lettre::transport::smtp::{SMTP_PORT, extension::ClientId, commands::*, client::SmtpConnection};
//!
//! let hello = ClientId::new_domain("my_hostname".to_string());
//! let hello = ClientId::Domain("my_hostname".to_string());
//! let mut client = SmtpConnection::connect(&("localhost", SMTP_PORT), None, &hello, None).unwrap();
//! client.command(
//! Mail::new(Some("user@example.com".parse().unwrap()), vec![])