treewide: format with nightly rustfmt; auto-fix Clippy lints
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If4fd0511087dbaa65afc56a34d7c2f166a6a6964
This commit is contained in:
parent
fe45fff3f3
commit
3a03cf7b3e
26 changed files with 222 additions and 161 deletions
|
|
@ -17,7 +17,7 @@ pub struct SessionData {
|
|||
|
||||
impl SessionData {
|
||||
/// Check if the session has admin role
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn is_admin(&self) -> bool {
|
||||
if let Some(ref user) = self.user {
|
||||
user.role == "admin"
|
||||
|
|
@ -29,7 +29,7 @@ impl SessionData {
|
|||
}
|
||||
|
||||
/// Check if the session has a specific role
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn has_role(&self, role: &str) -> bool {
|
||||
if self.is_admin() {
|
||||
return true;
|
||||
|
|
@ -44,7 +44,7 @@ impl SessionData {
|
|||
}
|
||||
|
||||
/// Get the display name for the session (username or api key name)
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub fn display_name(&self) -> String {
|
||||
if let Some(ref user) = self.user {
|
||||
user.username.clone()
|
||||
|
|
@ -56,7 +56,7 @@ impl SessionData {
|
|||
}
|
||||
|
||||
/// Check if this is a user session (not just API key)
|
||||
#[must_use]
|
||||
#[must_use]
|
||||
pub const fn is_user_session(&self) -> bool {
|
||||
self.user.is_some()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue