From 41aace5d7c793d453946442396cd51f0e8c4994a Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sat, 5 Apr 2025 15:20:04 +0200 Subject: [PATCH] bin/util-linux.rs: use let/else instead of match --- src/bin/util-linux.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/bin/util-linux.rs b/src/bin/util-linux.rs index fc2cd16..6a942ee 100644 --- a/src/bin/util-linux.rs +++ b/src/bin/util-linux.rs @@ -85,9 +85,8 @@ fn main() { process::exit(1); } - let util = match util_os.to_str() { - Some(util) => util, - None => not_found(&util_os), + let Some(util) = util_os.to_str() else { + not_found(&util_os) }; if util == "completion" { @@ -106,9 +105,8 @@ fn main() { if util == "--help" || util == "-h" { // see if they want help on a specific util if let Some(util_os) = args.next() { - let util = match util_os.to_str() { - Some(util) => util, - None => not_found(&util_os), + let Some(util) = util_os.to_str() else { + not_found(&util_os) }; match utils.get(util) {