Skip to content

Commit

Permalink
fix(indexer): clippy fixes (#1052)
Browse files Browse the repository at this point in the history
Description
---
Fix a few clippy errors 

Motivation and Context
---
Clippy errors on development

How Has This Been Tested?
---
Clippy passes

What process can a PR reviewer use to test or verify this change?
---
CI

Breaking Changes
---

- [x] None
- [ ] Requires data directory to be deleted
- [ ] Other - Please specify
  • Loading branch information
sdbondi authored Jun 19, 2024
1 parent 03a72be commit 0ebb1fb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
24 changes: 12 additions & 12 deletions applications/tari_indexer/src/event_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ impl EventManager {
version: u64,
timestamp: u64,
) -> Result<(), anyhow::Error> {
let mut tx = self.substate_store.create_write_tx()?;
let new_event = NewEvent {
substate_id: Some(substate_id.to_string()),
template_address: template_address.to_string(),
tx_hash: tx_hash.to_string(),
topic,
payload: payload.to_json().expect("Failed to convert to JSON"),
version: version as i32,
timestamp: timestamp as i64,
};
tx.save_event(new_event)?;
tx.commit()?;
self.substate_store.with_write_tx(|tx| {
let new_event = NewEvent {
substate_id: Some(substate_id.to_string()),
template_address: template_address.to_string(),
tx_hash: tx_hash.to_string(),
topic,
payload: payload.to_json().expect("Failed to convert to JSON"),
version: version as i32,
timestamp: timestamp as i64,
};
tx.save_event(new_event)
})?;
Ok(())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ impl<'a> SqliteSubstateStoreReadTransaction<'a> {
}
}

// TODO: remove the allow dead_code attributes as these become used.
pub trait SubstateStoreReadTransaction {
fn list_substates(
&mut self,
Expand All @@ -186,13 +187,17 @@ pub trait SubstateStoreReadTransaction {
offset: Option<u64>,
) -> Result<Vec<ListSubstateItem>, StorageError>;
fn get_substate(&mut self, address: &SubstateId) -> Result<Option<Substate>, StorageError>;
#[allow(dead_code)]
fn get_latest_version_for_substate(&mut self, address: &SubstateId) -> Result<Option<i64>, StorageError>;
#[allow(dead_code)]
fn get_all_addresses(&mut self) -> Result<Vec<(String, i64)>, StorageError>;
#[allow(dead_code)]
fn get_all_substates(&mut self) -> Result<Vec<Substate>, StorageError>;
fn get_non_fungible_collections(&mut self) -> Result<Vec<(String, i64)>, StorageError>;
fn get_non_fungible_count(&mut self, resource_address: String) -> Result<i64, StorageError>;
#[allow(dead_code)]
fn get_non_fungible_latest_index(&mut self, resource_address: String) -> Result<Option<i32>, StorageError>;
#[allow(dead_code)]
fn get_non_fungibles(
&mut self,
resource_address: String,
Expand Down Expand Up @@ -629,12 +634,16 @@ impl<'a> SqliteSubstateStoreWriteTransaction<'a> {
}
}

// TODO: remove the allow dead_code attributes as these become used.
pub trait SubstateStoreWriteTransaction {
fn commit(self) -> Result<(), StorageError>;
fn rollback(self) -> Result<(), StorageError>;
fn set_substate(&mut self, new_substate: NewSubstate) -> Result<(), StorageError>;
#[allow(dead_code)]
fn delete_substate(&mut self, address: String) -> Result<(), StorageError>;
#[allow(dead_code)]
fn clear_substates(&mut self) -> Result<(), StorageError>;
#[allow(dead_code)]
fn add_non_fungible_index(&mut self, new_nft_index: NewNonFungibleIndex) -> Result<(), StorageError>;
fn save_event(&mut self, new_event: NewEvent) -> Result<(), StorageError>;
fn save_scanned_block_id(&mut self, new_scanned_block_id: NewScannedBlockId) -> Result<(), StorageError>;
Expand Down

0 comments on commit 0ebb1fb

Please sign in to comment.