mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 08:12:24 +00:00
run clippy fix
This commit is contained in:
@@ -41,13 +41,13 @@ impl XmlSerialize for UserPrivilegeSet {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq)]
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub struct UserPrivilegeSet {
|
||||
privileges: HashSet<UserPrivilege>,
|
||||
}
|
||||
|
||||
impl UserPrivilegeSet {
|
||||
pub fn has(&self, privilege: &UserPrivilege) -> bool {
|
||||
#[must_use] pub fn has(&self, privilege: &UserPrivilege) -> bool {
|
||||
if (privilege == &UserPrivilege::WriteProperties
|
||||
|| privilege == &UserPrivilege::WriteContent)
|
||||
&& self.privileges.contains(&UserPrivilege::Write)
|
||||
@@ -57,13 +57,13 @@ impl UserPrivilegeSet {
|
||||
self.privileges.contains(privilege) || self.privileges.contains(&UserPrivilege::All)
|
||||
}
|
||||
|
||||
pub fn all() -> Self {
|
||||
#[must_use] pub fn all() -> Self {
|
||||
Self {
|
||||
privileges: HashSet::from([UserPrivilege::All]),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn owner_only(is_owner: bool) -> Self {
|
||||
#[must_use] pub fn owner_only(is_owner: bool) -> Self {
|
||||
if is_owner {
|
||||
Self::all()
|
||||
} else {
|
||||
@@ -71,7 +71,7 @@ impl UserPrivilegeSet {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn owner_read(is_owner: bool) -> Self {
|
||||
#[must_use] pub fn owner_read(is_owner: bool) -> Self {
|
||||
if is_owner {
|
||||
Self::read_only()
|
||||
} else {
|
||||
@@ -79,7 +79,7 @@ impl UserPrivilegeSet {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn owner_write_properties(is_owner: bool) -> Self {
|
||||
#[must_use] pub fn owner_write_properties(is_owner: bool) -> Self {
|
||||
// Content is read-only but we can write properties
|
||||
if is_owner {
|
||||
Self::write_properties()
|
||||
@@ -88,7 +88,7 @@ impl UserPrivilegeSet {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_only() -> Self {
|
||||
#[must_use] pub fn read_only() -> Self {
|
||||
Self {
|
||||
privileges: HashSet::from([
|
||||
UserPrivilege::Read,
|
||||
@@ -98,7 +98,7 @@ impl UserPrivilegeSet {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn write_properties() -> Self {
|
||||
#[must_use] pub fn write_properties() -> Self {
|
||||
Self {
|
||||
privileges: HashSet::from([
|
||||
UserPrivilege::Read,
|
||||
|
||||
Reference in New Issue
Block a user