Fix clippy findings

This commit is contained in:
Simon Goller 2024-06-06 08:08:30 +02:00
parent 99b9d85e47
commit 91559224e5
4 changed files with 22 additions and 13 deletions

View file

@ -11,12 +11,13 @@ mod test;
pub mod uuid_service;
pub use permission::PermissionServiceImpl;
use service::permission::MockContext;
pub struct UserServiceDev;
#[async_trait]
impl service::user_service::UserService for UserServiceDev {
type Context = ();
type Context = MockContext;
async fn current_user(
&self,
@ -36,8 +37,6 @@ impl service::user_service::UserService for UserServiceImpl {
&self,
context: Self::Context,
) -> Result<Arc<str>, service::ServiceError> {
context
.ok_or_else(|| service::ServiceError::Unauthorized)
.map(|user| user.clone())
context.ok_or_else(|| service::ServiceError::Unauthorized)
}
}

View file

@ -54,7 +54,11 @@ async fn test_user_service_dev() {
let user_service = UserServiceDev;
assert_eq!(
"DEVUSER",
user_service.current_user(()).await.unwrap().as_ref()
user_service
.current_user(MockContext)
.await
.unwrap()
.as_ref()
);
}