1
0
mirror of https://github.com/tonarino/innernet.git synced 2025-01-06 03:54:04 +02:00

fix tests

This commit is contained in:
Jake McGinty 2021-11-06 18:54:52 +09:00
parent d7cf24c63c
commit b0d0ee8565

View File

@ -19,16 +19,14 @@ pub struct Interface {
}
impl FromStr for Interface {
type Err = String;
type Err = InvalidInterfaceName;
fn from_str(name: &str) -> Result<Self, Self::Err> {
if !Hostname::is_valid(name) {
return Err("interface name is not a valid hostname".into());
Err(InvalidInterfaceName::InvalidChars)
} else {
Ok(Self { name: name.parse()? })
}
let name = name
.parse()
.map_err(|e: InvalidInterfaceName| e.to_string())?;
Ok(Self { name })
}
}