Skip to content

Commit

Permalink
fix : cargo clippy for rust-1.79 (metaplex-foundation#241)
Browse files Browse the repository at this point in the history
* fix : nft-ingester cargo clippy for rust-1.79

* update rust-toolchain to 1.79

* fix cargo clippy
  • Loading branch information
Nagaprasadvr authored Feb 15, 2025
1 parent 1b19650 commit 087fabf
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions digital_asset_types/src/dapi/change_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,18 @@ fn build_asset_proof(
tree_id: Vec<u8>,
leaf_node_idx: i64,
leaf_hash: Vec<u8>,
req_indexes: &Vec<i64>,
req_indexes: &[i64],
required_nodes: &[SimpleChangeLog],
) -> AssetProof {
let mut final_node_list = vec![SimpleChangeLog::default(); req_indexes.len()];
for node in required_nodes.iter() {
if node.level < final_node_list.len().try_into().unwrap() {
final_node_list[node.level as usize] = node.to_owned();
node.clone_into(&mut final_node_list[node.level as usize])
}
}
for (i, (n, nin)) in final_node_list
.iter_mut()
.zip(req_indexes.clone())
.enumerate()
{
for (i, (n, nin)) in final_node_list.iter_mut().zip(req_indexes).enumerate() {
if *n == SimpleChangeLog::default() {
*n = make_empty_node(i as i64, nin, tree_id.clone());
*n = make_empty_node(i as i64, *nin, tree_id.clone());
}
}
AssetProof {
Expand Down
3 changes: 3 additions & 0 deletions digital_asset_types/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ pub struct MockMetadataArgs {
/// Since we cannot easily change Metadata, we add the new DataV2 fields here at the end.
pub token_standard: Option<TokenStandard>,
/// Collection
#[allow(dead_code)]
pub collection: Option<Collection>,
/// Uses
#[allow(dead_code)]
pub uses: Option<Uses>,
/// Creators
pub creators: Vec<Creator>,
}

Expand Down
8 changes: 2 additions & 6 deletions nft_ingester/src/backfiller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const BLOCK_CACHE_SIZE: usize = 300_000;
const MAX_CACHE_COST: i64 = 32;
const BLOCK_CACHE_DURATION: u64 = 172800;

#[allow(dead_code)]
struct SlotSeq(u64, u64);
/// Main public entry point for backfiller task.
pub fn setup_backfiller<T: Messenger>(
Expand Down Expand Up @@ -799,12 +800,7 @@ impl<'a, T: Messenger> Backfiller<'a, T> {
.build(DbBackend::Postgres);

let start_seq_vec = MaxSeqItem::find_by_statement(query).all(&self.db).await?;
let start_seq = if let Some(seq) = start_seq_vec.last().map(|row| row.seq) {
seq
} else {
0
};

let start_seq = start_seq_vec.last().map(|row| row.seq).unwrap_or_default();
// Get all rows for the tree that have not yet been backfilled.
let mut query = backfill_items::Entity::find()
.select_only()
Expand Down
2 changes: 1 addition & 1 deletion nft_ingester/src/plerkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum PlerkleDeserializerError {

pub struct PlerkleAccountInfo<'a>(pub plerkle_serialization::AccountInfo<'a>);

impl<'a> TryFrom<PlerkleAccountInfo<'a>> for AccountInfo {
impl TryFrom<PlerkleAccountInfo<'_>> for AccountInfo {
type Error = PlerkleDeserializerError;

fn try_from(value: PlerkleAccountInfo) -> Result<Self, Self::Error> {
Expand Down
4 changes: 2 additions & 2 deletions nft_ingester/src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ impl TaskManager {
tokio::task::spawn(async move {
while let Some(task) = receiver.recv().await {
if let Some(task_created_time) = task.created_at {
let bus_time =
Utc::now().timestamp_millis() - task_created_time.timestamp_millis();
let bus_time = Utc::now().timestamp_millis()
- task_created_time.and_utc().timestamp_millis();
metric! {
statsd_histogram!("ingester.bgtask.bus_time", bus_time as u64, "type" => task.name);
}
Expand Down
2 changes: 2 additions & 0 deletions ops/src/bubblegum/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ impl TreeGapFill {
}

#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct TreeHeaderResponse {
pub max_depth: u32,
pub max_buffer_size: u32,
Expand All @@ -196,6 +197,7 @@ impl TryFrom<ConcurrentMerkleTreeHeader> for TreeHeaderResponse {
#[derive(Debug, Clone)]
pub struct TreeResponse {
pub pubkey: Pubkey,
#[allow(dead_code)]
pub tree_header: TreeHeaderResponse,
pub seq: u64,
}
Expand Down
2 changes: 1 addition & 1 deletion program_transformers/src/bubblegum/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ where
pub async fn upsert_asset_creators<T>(
txn: &T,
id: Vec<u8>,
creators: &Vec<Creator>,
creators: &[Creator],
slot_updated: i64,
seq: i64,
) -> ProgramTransformerResult<()>
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.75.0"
channel = "1.79.0"
components = ["clippy", "rustfmt"]
targets = []
profile = "minimal"

0 comments on commit 087fabf

Please sign in to comment.