Skip to content

Commit

Permalink
Fix Clippy: Use idiomatic find() instead of loop (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
intgr committed Sep 27, 2022
1 parent 06046f6 commit fac1796
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/acl.rs
Expand Up @@ -207,14 +207,10 @@ impl PosixACL {
}

fn raw_get_entry(&self, qual: &Qualifier) -> Option<acl_entry_t> {
for entry in unsafe { self.raw_iter() } {
unsafe { self.raw_iter() }.find(
// XXX this is slightly inefficient, calls to get_entry_uid() could be short-circuited.
if Qualifier::from_entry(entry) == *qual {
// Found it!
return Some(entry);
}
}
None
|&entry| Qualifier::from_entry(entry) == *qual,
)
}

fn raw_add_entry(&mut self, qual: &Qualifier) -> acl_entry_t {
Expand Down

0 comments on commit fac1796

Please sign in to comment.