Skip to content

Commit

Permalink
style(cache): use clone to fix clippy issues
Browse files Browse the repository at this point in the history
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
  • Loading branch information
gierens committed Apr 23, 2024
1 parent 1eef5f7 commit 8587119
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl Users for UsersCache {

let entry = match users.forward.entry(uid) {
Vacant(e) => e,
Occupied(e) => return e.get().as_ref().map(Arc::clone),
Occupied(e) => return e.get().clone(),
};

if let Some(user) = super::get_user_by_uid(uid) {
Expand All @@ -266,9 +266,7 @@ impl Users for UsersCache {

let entry = match users.backward.entry(Arc::from(username.as_ref())) {
Vacant(e) => e,
Occupied(e) => {
return (*e.get()).and_then(|uid| users.forward[&uid].as_ref().map(Arc::clone))
}
Occupied(e) => return (*e.get()).and_then(|uid| users.forward[&uid].clone()),
};

if let Some(user) = super::get_user_by_name(username) {
Expand Down Expand Up @@ -318,7 +316,7 @@ impl Groups for UsersCache {

let entry = match groups.forward.entry(gid) {
Vacant(e) => e,
Occupied(e) => return e.get().as_ref().map(Arc::clone),
Occupied(e) => return e.get().clone(),
};

if let Some(group) = super::get_group_by_gid(gid) {
Expand Down

0 comments on commit 8587119

Please sign in to comment.