Conversation
c7d3140 to
d47a3a3
Compare
alexcottner
left a comment
There was a problem hiding this comment.
looks reasonable to me
|
Is it more idiomatic to do this as it was? --- a/components/remote_settings/src/storage.rs
+++ b/components/remote_settings/src/storage.rs
@@ -140,7 +140,7 @@ impl Storage {
let mut stmt_metadata = tx.prepare(
"SELECT bucket, signatures FROM collection_metadata WHERE collection_url = ?",
)?;
- let result = stmt_metadata
+ if let Some(metadata) = stmt_metadata
.query_row(params![collection_url], |row| {
let bucket: String = row.get(0)?;
let signatures_json: String = row.get(1)?;
@@ -154,8 +154,12 @@ impl Storage {
})?;
Ok(CollectionMetadata { bucket, signatures })
})
- .optional()?;
- Ok(result)
+ .optional()?
+ {
+ Ok(Some(metadata))
+ } else {
+ Ok(None)
+ }
} |
I think I prefer the way you have it now slightly. But I'm still somewhat new to rust. |
I think the way you have it is fine. But maybe you could just do something like this: |
bendk
left a comment
There was a problem hiding this comment.
Looks right to me and the tests are great. I left a few suggestions, but none of them are required. Whatever you think is best is good with me.
|
BTW, I don't think it helps here but there's also the |
Pull Request checklist
[ci full]to the PR title.