diff --git a/net_util/src/mac.rs b/net_util/src/mac.rs index 4a032ffa2..ebf246d6b 100644 --- a/net_util/src/mac.rs +++ b/net_util/src/mac.rs @@ -65,9 +65,12 @@ impl MacAddr { // An error can only occur if the slice length is different from MAC_ADDR_LEN. #[inline] - pub fn from_bytes(src: &[u8]) -> Result { + pub fn from_bytes(src: &[u8]) -> Result { if src.len() != MAC_ADDR_LEN { - return Err(()); + return Err(io::Error::new( + io::ErrorKind::Other, + format!("invalid length of slice: {} vs {}", src.len(), MAC_ADDR_LEN), + )); } Ok(MacAddr::from_bytes_unchecked(src)) } diff --git a/net_util/src/tap.rs b/net_util/src/tap.rs index 69828f4c8..4be620518 100644 --- a/net_util/src/tap.rs +++ b/net_util/src/tap.rs @@ -31,7 +31,7 @@ pub enum Error { NetUtil(NetUtilError), InvalidIfname, /// Error parsing MAC data - MacParsing(()), + MacParsing(IoError), } pub type Result = ::std::result::Result;