Fix clippy warnings
This commit is contained in:
parent
011bcf9edc
commit
21c1f8cc87
|
@ -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
|
||||||
|
|
|
@ -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>>();
|
||||||
|
|
Loading…
Reference in New Issue