Format code

This commit is contained in:
2022-04-03 15:50:49 +02:00
parent 9236b91f12
commit b965fa6b4f
20 changed files with 149 additions and 106 deletions

View File

@@ -80,10 +80,13 @@ impl EntityManager<User> {
}
/// Update user information
fn update_user<F>(&mut self, id: &UserID, update: F) -> bool where F: FnOnce(User) -> User {
fn update_user<F>(&mut self, id: &UserID, update: F) -> bool
where
F: FnOnce(User) -> User,
{
let user = match self.find_by_user_id(id) {
None => return false,
Some(user) => user
Some(user) => user,
};
if let Err(e) = self.replace_entries(|u| u.uid.eq(id), &update(user)) {
@@ -96,7 +99,7 @@ impl EntityManager<User> {
pub fn change_user_password(&mut self, id: &UserID, password: &str, temporary: bool) -> bool {
let new_hash = match hash_password(password) {
Ok(h) => { h }
Ok(h) => h,
Err(e) => {
log::error!("Failed to hash user password! {}", e);
return false;
@@ -109,4 +112,4 @@ impl EntityManager<User> {
user
})
}
}
}