mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
safer code
This commit is contained in:
1 parent
ee8d044bb8
commit
91f114eaec
1 file changed
+2
-2
@@ -54,12 +54,12 @@ pub async fn require_moderator(
|
||||
|
||||
saved_connection = Some(connection);
|
||||
|
||||
saved_connection.as_mut().expect("this should be safe - we just saved the connection")
|
||||
// NB: We just saved it, so it shouldn't error. Safer than unwrap/expect.
|
||||
saved_connection.as_mut().ok_or(RequireModeratorError::ServerError)?
|
||||
},
|
||||
UseDatabase::FromPool(pool) => pool,
|
||||
};
|
||||
|
||||
|
||||
let maybe_user_session = server_state
|
||||
.session_checker
|
||||
.maybe_get_user_session_from_connection(&http_request, mysql_connection)
|
||||
|
||||
Reference in new issue
Block a user