Skip to content

Commit

Permalink
Allow TryFrom<&str> for ServerName::IpAddress without std
Browse files Browse the repository at this point in the history
  • Loading branch information
djc authored and cpu committed Dec 5, 2023
1 parent 7ceb2f3 commit f8e6d9d
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/server_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,10 @@ impl<'a> TryFrom<&'a str> for ServerName<'a> {
fn try_from(s: &'a str) -> Result<Self, Self::Error> {
match DnsName::try_from(s) {
Ok(dns) => Ok(Self::DnsName(dns)),
#[cfg(feature = "std")]
Err(InvalidDnsNameError) => match IpAddr::try_from(s) {
Ok(ip) => Ok(Self::IpAddress(ip)),
Err(_) => Err(InvalidDnsNameError),
},
#[cfg(not(feature = "std"))]
Err(InvalidDnsNameError) => Err(InvalidDnsNameError),
}
}
}
Expand Down

0 comments on commit f8e6d9d

Please sign in to comment.