0
0
mirror of https://github.com/TeFiLeDo/tree-owners.git synced 2024-11-21 20:06:17 +01:00

apply suggested fixes

This commit is contained in:
Adrian Wannenmacher 2023-09-24 14:46:17 +02:00
parent 5ad2ece4e4
commit 5b0a00d140
Signed by: tfld
GPG Key ID: 19D986ECB1E492D5
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
use std::{fs::read_dir, os::linux::fs::MetadataExt, path::Path}; use std::{fs::read_dir, os::linux::fs::MetadataExt, path::Path};
use anyhow::{anyhow, ensure, Context, Error, Result}; use anyhow::{anyhow, Context, Error, Result};
use clap::Parser; use clap::Parser;
use crate::{cli::Args, summary::Summary}; use crate::{cli::Args, summary::Summary};

View File

@ -3,6 +3,9 @@ use std::{collections::BTreeMap, fmt::Display};
use file_owner::{FileOwnerError, Group, Owner}; use file_owner::{FileOwnerError, Group, Owner};
use serde::Serialize; use serde::Serialize;
/// An error specific to a `uid` or `gid`.
pub type IdError = (u32, FileOwnerError);
/// Lists of unique [User]s and [Group]s. /// Lists of unique [User]s and [Group]s.
#[derive(Debug, Default, Serialize)] #[derive(Debug, Default, Serialize)]
pub struct Summary { pub struct Summary {
@ -22,7 +25,7 @@ impl Summary {
} }
/// Look up the names of all users and groups. /// Look up the names of all users and groups.
pub fn lookup_names(&mut self) -> (Vec<(u32, FileOwnerError)>, Vec<(u32, FileOwnerError)>) { pub fn lookup_names(&mut self) -> (Vec<IdError>, Vec<IdError>) {
let mut user_failures = vec![]; let mut user_failures = vec![];
for (uid, name) in &mut self.users { for (uid, name) in &mut self.users {
if name.is_some() { if name.is_some() {