summaryrefslogtreecommitdiff
path: root/src/repository
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-03-16 13:53:13 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-03-16 13:53:13 +0100
commit2689fe31f9f86ba190faea99635e62f624e3e02d (patch)
treecb9fbd9495c24362b1e6ed2ddb3a399633858586 /src/repository
parent517107f718d3474128028f1e72fce1a62150bd5d (diff)
chore: better use of query_opt
Diffstat (limited to 'src/repository')
-rw-r--r--src/repository/models.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/repository/models.rs b/src/repository/models.rs
index 1cbf3bb..e3d8456 100644
--- a/src/repository/models.rs
+++ b/src/repository/models.rs
@@ -180,12 +180,9 @@ impl Repository {
};
let repo = client
- .query(&statement, &[&uuid, &repo_name, &user_ip])
+ .query_opt(&statement, &[&uuid, &repo_name, &user_ip])
.await?
- .iter()
- .map(|row| Repository::from_row_ref(row).unwrap())
- .collect::<Vec<Repository>>()
- .pop();
+ .map(|row| Repository::from_row_ref(&row).unwrap());
match repo {
Some(repo) => Ok(repo),