fix: use borrow

This commit is contained in:
Fu Zi Xiang 2023-09-18 11:59:35 +08:00
parent 7ae645a7c1
commit 73be24ad2b
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View File

@ -164,7 +164,7 @@ impl From<Vec<AFWorkspace>> for AFWorkspaces {
}
impl AFWorkspaces {
pub fn get_latest(&self, profile: AFUserProfileView) -> Option<AFWorkspace> {
pub fn get_latest(&self, profile: &AFUserProfileView) -> Option<AFWorkspace> {
match profile.latest_workspace_id {
Some(ws_id) => self.0.iter().find(|ws| ws.workspace_id == ws_id).cloned(),
None => None,

View File

@ -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());
}