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,
}
#[allow(clippy::enum_variant_names)]
#[derive(Parser)]
pub enum UserCommand {
/// 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")?;
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::<Vec<Group>>();