diff --git a/src/id.rs b/src/id.rs index 5c1e946..449ef51 100644 --- a/src/id.rs +++ b/src/id.rs @@ -17,6 +17,10 @@ pub struct Id(pub [u8; RAW_LEN]); impl Id { /// Create an Id from a bytes slice. + /// + /// # Errors + /// + /// Will return `Err` if the length of `bytes` is invalid. pub fn from_bytes(bytes: &[u8]) -> Result { if bytes.len() != RAW_LEN { return Err(ParseIdError::InvalidLength(bytes.len())); @@ -65,6 +69,7 @@ impl Id { } /// Returns true if this is a "zero" ID + #[must_use] pub fn is_zero(&self) -> bool { self.0 == ZERO.0 } diff --git a/src/machine_id.rs b/src/machine_id.rs index 7db1ee5..ff5f5e6 100644 --- a/src/machine_id.rs +++ b/src/machine_id.rs @@ -1,5 +1,5 @@ use rand::RngCore; -#[cfg(any(target_os = "macos"))] +#[cfg(target_os = "macos")] use sysctl::{Sysctl, SysctlError}; // https://github.com/rs/xid/blob/efa678f304ab65d6d57eedcb086798381ae22206/id.go#L117