From fa4837bbb11e6bbe06819884dd01061a7e36a77b Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Sun, 12 Oct 2025 17:10:49 +0200 Subject: [PATCH] clippy: re-enable manual_let_else lint --- Cargo.toml | 2 -- src/uucore/src/lib/features/format/argument.rs | 16 ++++++---------- src/uucore/src/lib/features/systemd_logind.rs | 5 ++--- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cfe3e5b38..78329e5e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -628,7 +628,6 @@ semicolon_if_nothing_returned = "warn" single_char_pattern = "warn" explicit_iter_loop = "warn" if_not_else = "warn" -manual_let_else = "warn" all = { level = "deny", priority = -1 } cargo = { level = "warn", priority = -1 } @@ -695,7 +694,6 @@ enum_glob_use = "allow" ptr_cast_constness = "allow" borrow_as_ptr = "allow" ptr_as_ptr = "allow" -manual_let_else = "allow" unnecessary_semicolon = "allow" needless_raw_string_hashes = "allow" unreadable_literal = "allow" diff --git a/src/uucore/src/lib/features/format/argument.rs b/src/uucore/src/lib/features/format/argument.rs index 935f28826..3561bd4a7 100644 --- a/src/uucore/src/lib/features/format/argument.rs +++ b/src/uucore/src/lib/features/format/argument.rs @@ -122,18 +122,14 @@ impl<'a> FormatArguments<'a> { { // If this fails (this can only happens on Windows), then just // return NotNumeric. - let s = match os_str_as_bytes(os) { - Ok(s) => s, - Err(_) => return Err(ExtendedParserError::NotNumeric), + let Ok(s) = os_str_as_bytes(os) else { + return Err(ExtendedParserError::NotNumeric); }; - let bytes = match s.split_first() { - Some((b'"', bytes)) | Some((b'\'', bytes)) => bytes, - _ => { - // This really can't happen, the string we are given must start with '/". - debug_assert!(false); - return Err(ExtendedParserError::NotNumeric); - } + let (Some((b'"', bytes)) | Some((b'\'', bytes))) = s.split_first() else { + // This really can't happen, the string we are given must start with '/". + debug_assert!(false); + return Err(ExtendedParserError::NotNumeric); }; if bytes.is_empty() { diff --git a/src/uucore/src/lib/features/systemd_logind.rs b/src/uucore/src/lib/features/systemd_logind.rs index a59db3b1c..0e599cfe5 100644 --- a/src/uucore/src/lib/features/systemd_logind.rs +++ b/src/uucore/src/lib/features/systemd_logind.rs @@ -350,9 +350,8 @@ pub fn read_login_records() -> UResult> { // Iterate through all sessions for session_id in sessions { // Get session UID using safe wrapper - let uid = match login::get_session_uid(&session_id) { - Ok(uid) => uid, - Err(_) => continue, + let Ok(uid) = login::get_session_uid(&session_id) else { + continue; }; // Get username from UID