mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 21:42:34 +00:00
appeasing to clippy
This commit is contained in:
@@ -73,7 +73,7 @@ where
|
|||||||
}
|
}
|
||||||
CommonPropertiesPropName::CurrentUserPrincipal => {
|
CommonPropertiesPropName::CurrentUserPrincipal => {
|
||||||
CommonPropertiesProp::CurrentUserPrincipal(
|
CommonPropertiesProp::CurrentUserPrincipal(
|
||||||
R::PrincipalResource::get_url(rmap, &[&user.id])
|
R::PrincipalResource::get_url(rmap, [&user.id])
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into(),
|
.into(),
|
||||||
)
|
)
|
||||||
@@ -81,13 +81,11 @@ where
|
|||||||
CommonPropertiesPropName::CurrentUserPrivilegeSet => {
|
CommonPropertiesPropName::CurrentUserPrivilegeSet => {
|
||||||
CommonPropertiesProp::CurrentUserPrivilegeSet(resource.get_user_privileges(user)?)
|
CommonPropertiesProp::CurrentUserPrivilegeSet(resource.get_user_privileges(user)?)
|
||||||
}
|
}
|
||||||
CommonPropertiesPropName::Owner => {
|
CommonPropertiesPropName::Owner => CommonPropertiesProp::Owner(
|
||||||
CommonPropertiesProp::Owner(resource.get_owner().map(|owner| {
|
resource
|
||||||
R::PrincipalResource::get_url(rmap, &[owner])
|
.get_owner()
|
||||||
.unwrap()
|
.map(|owner| R::PrincipalResource::get_url(rmap, [owner]).unwrap().into()),
|
||||||
.into()
|
),
|
||||||
}))
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,8 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use strum::VariantNames;
|
use strum::VariantNames;
|
||||||
|
|
||||||
pub trait ResourceReadProp: Serialize + InvalidProperty {}
|
pub trait ResourceProp: InvalidProperty + Serialize + for<'de> Deserialize<'de> {}
|
||||||
impl<T: Serialize + InvalidProperty> ResourceReadProp for T {}
|
impl<T: InvalidProperty + Serialize + for<'de> Deserialize<'de>> ResourceProp for T {}
|
||||||
|
|
||||||
pub trait ResourceProp: ResourceReadProp + for<'de> Deserialize<'de> {}
|
|
||||||
impl<T: ResourceReadProp + for<'de> Deserialize<'de>> ResourceProp for T {}
|
|
||||||
|
|
||||||
pub trait ResourcePropName: FromStr + VariantNames {}
|
pub trait ResourcePropName: FromStr + VariantNames {}
|
||||||
impl<T: FromStr + VariantNames> ResourcePropName for T {}
|
impl<T: FromStr + VariantNames> ResourcePropName for T {}
|
||||||
@@ -41,8 +38,8 @@ pub trait Resource: Clone + 'static {
|
|||||||
vec![CommonPropertiesExtension::default()]
|
vec![CommonPropertiesExtension::default()]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn list_props() -> Vec<&'static str> {
|
fn list_props() -> &'static [&'static str] {
|
||||||
Self::PropName::VARIANTS.iter().map(|&prop| prop).collect()
|
Self::PropName::VARIANTS
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_prop(
|
fn get_prop(
|
||||||
@@ -125,7 +122,7 @@ pub trait Resource: Clone + 'static {
|
|||||||
Error::BadRequest("allprop MUST be the only queried prop".to_owned()).into(),
|
Error::BadRequest("allprop MUST be the only queried prop".to_owned()).into(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
props = Self::list_props().into();
|
props = Self::list_props();
|
||||||
for extension in Self::list_extensions() {
|
for extension in Self::list_extensions() {
|
||||||
let ext_props: Vec<&str> = extension.list_props().into();
|
let ext_props: Vec<&str> = extension.list_props().into();
|
||||||
props.extend(ext_props);
|
props.extend(ext_props);
|
||||||
|
|||||||
Reference in New Issue
Block a user