From 73be24ad2b08eadb0d7532ad46dd9e67c28cd220 Mon Sep 17 00:00:00 2001 From: Fu Zi Xiang Date: Mon, 18 Sep 2023 11:59:35 +0800 Subject: [PATCH] fix: use borrow --- libs/storage-entity/src/lib.rs | 2 +- tests/client/sign_in.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/storage-entity/src/lib.rs b/libs/storage-entity/src/lib.rs index 2fc187da..7e8faf96 100644 --- a/libs/storage-entity/src/lib.rs +++ b/libs/storage-entity/src/lib.rs @@ -164,7 +164,7 @@ impl From> for AFWorkspaces { } impl AFWorkspaces { - pub fn get_latest(&self, profile: AFUserProfileView) -> Option { + pub fn get_latest(&self, profile: &AFUserProfileView) -> Option { match profile.latest_workspace_id { Some(ws_id) => self.0.iter().find(|ws| ws.workspace_id == ws_id).cloned(), None => None, diff --git a/tests/client/sign_in.rs b/tests/client/sign_in.rs index 79ff1fa6..af908d47 100644 --- a/tests/client/sign_in.rs +++ b/tests/client/sign_in.rs @@ -61,7 +61,7 @@ async fn sign_in_success() { let workspaces = c.workspaces().await.unwrap(); assert!(!workspaces.0.is_empty()); let profile = c.profile().await.unwrap(); - let latest_workspace = workspaces.get_latest(profile); + let latest_workspace = workspaces.get_latest(&profile); assert!(latest_workspace.is_some()); }