Skip to content

Commit

Permalink
fix(queries): fix more clippy warns
Browse files Browse the repository at this point in the history
Signed-off-by: ⭐️NINIKA⭐️ <[email protected]>
  • Loading branch information
DCNick3 authored and mversic committed Aug 9, 2024
1 parent 1cecbbe commit 12f8ed3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/src/query/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ impl LiveQueryStoreHandle {
}

/// Remove query from the storage if there is any.
pub fn drop_query(&self, query_id: QueryId) {
self.store.remove(&query_id);
pub fn drop_query(&self, query_id: &QueryId) {
self.store.remove(query_id);
}

fn construct_query_response(
Expand Down
1 change: 1 addition & 0 deletions core/src/smartcontracts/isi/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ impl ValidQueryRequest {
/// # Errors
///
/// Returns an error if the query execution fails.
#[allow(clippy::too_many_lines)] // not much we can do, we _need_ to list all the box types here
pub fn execute(
self,
live_query_store: &LiveQueryStoreHandle,
Expand Down
2 changes: 1 addition & 1 deletion core/src/smartcontracts/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ fn forget_all_executed_queries(
executed_queries: impl IntoIterator<Item = QueryId>,
) {
for query_id in executed_queries {
query_handle.drop_query(query_id);
query_handle.drop_query(&query_id);
}
}

Expand Down
6 changes: 3 additions & 3 deletions data_model/src/query/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ where
match (first, second) {
(None, None) => Ok(None),
(Some(result), None) => Ok(Some(result)),
(Some(_), Some(_)) => Err(SingleQueryError::ExpectedOneOrZeroGotMany.into()),
(Some(_), Some(_)) => Err(SingleQueryError::ExpectedOneOrZeroGotMany),
(None, Some(_)) => {
unreachable!()
}
Expand All @@ -358,9 +358,9 @@ where
let second = iter.next().transpose()?;

match (first, second) {
(None, None) => Err(SingleQueryError::ExpectedOneGotNone.into()),
(None, None) => Err(SingleQueryError::ExpectedOneGotNone),
(Some(result), None) => Ok(result),
(Some(_), Some(_)) => Err(SingleQueryError::ExpectedOneGotMany.into()),
(Some(_), Some(_)) => Err(SingleQueryError::ExpectedOneGotMany),
(None, Some(_)) => {
unreachable!()
}
Expand Down

0 comments on commit 12f8ed3

Please sign in to comment.