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 => {
|
||||
CommonPropertiesProp::CurrentUserPrincipal(
|
||||
R::PrincipalResource::get_url(rmap, &[&user.id])
|
||||
R::PrincipalResource::get_url(rmap, [&user.id])
|
||||
.unwrap()
|
||||
.into(),
|
||||
)
|
||||
@@ -81,13 +81,11 @@ where
|
||||
CommonPropertiesPropName::CurrentUserPrivilegeSet => {
|
||||
CommonPropertiesProp::CurrentUserPrivilegeSet(resource.get_user_privileges(user)?)
|
||||
}
|
||||
CommonPropertiesPropName::Owner => {
|
||||
CommonPropertiesProp::Owner(resource.get_owner().map(|owner| {
|
||||
R::PrincipalResource::get_url(rmap, &[owner])
|
||||
.unwrap()
|
||||
.into()
|
||||
}))
|
||||
}
|
||||
CommonPropertiesPropName::Owner => CommonPropertiesProp::Owner(
|
||||
resource
|
||||
.get_owner()
|
||||
.map(|owner| R::PrincipalResource::get_url(rmap, [owner]).unwrap().into()),
|
||||
),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,8 @@ use serde::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
use strum::VariantNames;
|
||||
|
||||
pub trait ResourceReadProp: Serialize + InvalidProperty {}
|
||||
impl<T: Serialize + InvalidProperty> ResourceReadProp for T {}
|
||||
|
||||
pub trait ResourceProp: ResourceReadProp + for<'de> Deserialize<'de> {}
|
||||
impl<T: ResourceReadProp + for<'de> Deserialize<'de>> ResourceProp for T {}
|
||||
pub trait ResourceProp: InvalidProperty + Serialize + for<'de> Deserialize<'de> {}
|
||||
impl<T: InvalidProperty + Serialize + for<'de> Deserialize<'de>> ResourceProp for T {}
|
||||
|
||||
pub trait ResourcePropName: FromStr + VariantNames {}
|
||||
impl<T: FromStr + VariantNames> ResourcePropName for T {}
|
||||
@@ -41,8 +38,8 @@ pub trait Resource: Clone + 'static {
|
||||
vec![CommonPropertiesExtension::default()]
|
||||
}
|
||||
|
||||
fn list_props() -> Vec<&'static str> {
|
||||
Self::PropName::VARIANTS.iter().map(|&prop| prop).collect()
|
||||
fn list_props() -> &'static [&'static str] {
|
||||
Self::PropName::VARIANTS
|
||||
}
|
||||
|
||||
fn get_prop(
|
||||
@@ -125,7 +122,7 @@ pub trait Resource: Clone + 'static {
|
||||
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() {
|
||||
let ext_props: Vec<&str> = extension.list_props().into();
|
||||
props.extend(ext_props);
|
||||
|
||||
Reference in New Issue
Block a user