Skip to content

Commit b2c9e8a

Browse files
use hostname-0.1.5 for now (#1)
use hostname-0.1.5 for now
2 parents f6bf23d + 2f6abd2 commit b2c9e8a

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ nom = { version = "^5.0", optional = true }
2323
bufstream = { version = "^0.1", optional = true }
2424
rustls = { version = "^0.16", optional = true }
2525
base64 = { version = "^0.11", optional = true }
26-
hostname = { version = "^0.2", optional = true }
26+
hostname = { version = "0.1.5", optional = true }
2727
serde = { version = "^1.0", optional = true }
2828
serde_json = { version = "^1.0", optional = true }
2929
serde_derive = { version = "^1.0", optional = true }

src/smtp/extension.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::smtp::authentication::Mechanism;
44
use crate::smtp::error::Error;
55
use crate::smtp::response::Response;
66
use crate::smtp::util::XText;
7-
use hostname::get as get_hostname;
7+
use hostname::get_hostname;
88
use std::collections::HashSet;
99
use std::fmt::{self, Display, Formatter};
1010
use std::net::{Ipv4Addr, Ipv6Addr};
@@ -47,14 +47,7 @@ impl ClientId {
4747
/// Defines a `ClientId` with the current hostname, of `localhost` if hostname could not be
4848
/// found
4949
pub fn hostname() -> ClientId {
50-
ClientId::Domain(
51-
get_hostname()
52-
.map(|s| {
53-
s.into_string()
54-
.unwrap_or_else(|_| DEFAULT_DOMAIN_CLIENT_ID.to_string())
55-
})
56-
.unwrap_or_else(|_| DEFAULT_DOMAIN_CLIENT_ID.to_string()),
57-
)
50+
ClientId::Domain(get_hostname().unwrap_or_else(|| DEFAULT_DOMAIN_CLIENT_ID.to_string()))
5851
}
5952
}
6053

0 commit comments

Comments
 (0)