From 21c1f8cc8796a542ec16a5234e33770b8d3709e1 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 7 Aug 2024 23:10:37 +0200 Subject: [PATCH] Fix clippy warnings --- src/cli/user_command.rs | 1 + src/core/common.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cli/user_command.rs b/src/cli/user_command.rs index 5adfc7c..b06641a 100644 --- a/src/cli/user_command.rs +++ b/src/cli/user_command.rs @@ -20,6 +20,7 @@ pub struct UserArgs { subcmd: UserCommand, } +#[allow(clippy::enum_variant_names)] #[derive(Parser)] pub enum UserCommand { /// Create one or more users diff --git a/src/core/common.rs b/src/core/common.rs index ebe592f..7d79aef 100644 --- a/src/core/common.rs +++ b/src/core/common.rs @@ -25,17 +25,16 @@ pub fn get_unix_groups(user: &User) -> anyhow::Result> { CString::new(user.name.as_bytes()).context("Failed to convert username to CStr")?; let groups = nix::unistd::getgrouplist(&user_cstr, user.gid)? .iter() - .filter_map(|gid| { - match Group::from_gid(*gid).map_err(|e| { - log::trace!( + .filter_map(|gid| match Group::from_gid(*gid) { + Ok(Some(group)) => Some(group), + Ok(None) => None, + Err(e) => { + log::warn!( "Failed to look up group with GID {}: {}\nIgnoring...", gid, e ); - e - }) { - Ok(Some(group)) => Some(group), - _ => None, + None } }) .collect::>();