diff --git a/aya/src/util.rs b/aya/src/util.rs index f3b68017..eaeb9e7f 100644 --- a/aya/src/util.rs +++ b/aya/src/util.rs @@ -154,10 +154,7 @@ impl KernelVersion { fn parse_kernel_version_string(s: &str) -> Result { fn parse>(s: Option<&str>) -> Option { - match s.map(str::parse).transpose() { - Ok(option) => option, - Err(ParseIntError { .. }) => None, - } + s.map(str::parse).transpose().unwrap_or_default() } let error = || CurrentKernelVersionError::ParseError(s.to_string()); let mut parts = s.split(|c: char| c == '.' || !c.is_ascii_digit());