From 78acd74badb6aa2463f89fbdf713325dad75dc9e Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Fri, 14 Jun 2024 10:30:12 -0400 Subject: [PATCH] Appease clippy ``` error: match can be simplified with `.unwrap_or_default()` --> aya/src/util.rs:157:13 | 157 | / match s.map(str::parse).transpose() { 158 | | Ok(option) => option, 159 | | Err(ParseIntError { .. }) => None, 160 | | } | |_____________^ help: replace it with: `s.map(str::parse).transpose().unwrap_or_default()` ``` --- aya/src/util.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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());