Fix clippy warnings

This commit is contained in:
Oystein Kristoffer Tveit 2024-08-07 23:10:37 +02:00
parent 011bcf9edc
commit 21c1f8cc87
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
2 changed files with 7 additions and 7 deletions

View File

@ -20,6 +20,7 @@ pub struct UserArgs {
subcmd: UserCommand, subcmd: UserCommand,
} }
#[allow(clippy::enum_variant_names)]
#[derive(Parser)] #[derive(Parser)]
pub enum UserCommand { pub enum UserCommand {
/// Create one or more users /// Create one or more users

View File

@ -25,17 +25,16 @@ pub fn get_unix_groups(user: &User) -> anyhow::Result<Vec<Group>> {
CString::new(user.name.as_bytes()).context("Failed to convert username to CStr")?; CString::new(user.name.as_bytes()).context("Failed to convert username to CStr")?;
let groups = nix::unistd::getgrouplist(&user_cstr, user.gid)? let groups = nix::unistd::getgrouplist(&user_cstr, user.gid)?
.iter() .iter()
.filter_map(|gid| { .filter_map(|gid| match Group::from_gid(*gid) {
match Group::from_gid(*gid).map_err(|e| { Ok(Some(group)) => Some(group),
log::trace!( Ok(None) => None,
Err(e) => {
log::warn!(
"Failed to look up group with GID {}: {}\nIgnoring...", "Failed to look up group with GID {}: {}\nIgnoring...",
gid, gid,
e e
); );
e None
}) {
Ok(Some(group)) => Some(group),
_ => None,
} }
}) })
.collect::<Vec<Group>>(); .collect::<Vec<Group>>();