Skip to content

Commit 087fabf

Browse files
authored
fix : cargo clippy for rust-1.79 (#241)
* fix : nft-ingester cargo clippy for rust-1.79 * update rust-toolchain to 1.79 * fix cargo clippy
1 parent 1b19650 commit 087fabf

File tree

9 files changed

+18
-21
lines changed

9 files changed

+18
-21
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

digital_asset_types/src/dapi/change_logs.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,18 @@ fn build_asset_proof(
200200
tree_id: Vec<u8>,
201201
leaf_node_idx: i64,
202202
leaf_hash: Vec<u8>,
203-
req_indexes: &Vec<i64>,
203+
req_indexes: &[i64],
204204
required_nodes: &[SimpleChangeLog],
205205
) -> AssetProof {
206206
let mut final_node_list = vec![SimpleChangeLog::default(); req_indexes.len()];
207207
for node in required_nodes.iter() {
208208
if node.level < final_node_list.len().try_into().unwrap() {
209-
final_node_list[node.level as usize] = node.to_owned();
209+
node.clone_into(&mut final_node_list[node.level as usize])
210210
}
211211
}
212-
for (i, (n, nin)) in final_node_list
213-
.iter_mut()
214-
.zip(req_indexes.clone())
215-
.enumerate()
216-
{
212+
for (i, (n, nin)) in final_node_list.iter_mut().zip(req_indexes).enumerate() {
217213
if *n == SimpleChangeLog::default() {
218-
*n = make_empty_node(i as i64, nin, tree_id.clone());
214+
*n = make_empty_node(i as i64, *nin, tree_id.clone());
219215
}
220216
}
221217
AssetProof {

digital_asset_types/tests/common.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ pub struct MockMetadataArgs {
3131
/// Since we cannot easily change Metadata, we add the new DataV2 fields here at the end.
3232
pub token_standard: Option<TokenStandard>,
3333
/// Collection
34+
#[allow(dead_code)]
3435
pub collection: Option<Collection>,
3536
/// Uses
37+
#[allow(dead_code)]
3638
pub uses: Option<Uses>,
39+
/// Creators
3740
pub creators: Vec<Creator>,
3841
}
3942

nft_ingester/src/backfiller.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const BLOCK_CACHE_SIZE: usize = 300_000;
6666
const MAX_CACHE_COST: i64 = 32;
6767
const BLOCK_CACHE_DURATION: u64 = 172800;
6868

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

801802
let start_seq_vec = MaxSeqItem::find_by_statement(query).all(&self.db).await?;
802-
let start_seq = if let Some(seq) = start_seq_vec.last().map(|row| row.seq) {
803-
seq
804-
} else {
805-
0
806-
};
807-
803+
let start_seq = start_seq_vec.last().map(|row| row.seq).unwrap_or_default();
808804
// Get all rows for the tree that have not yet been backfilled.
809805
let mut query = backfill_items::Entity::find()
810806
.select_only()

nft_ingester/src/plerkle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub enum PlerkleDeserializerError {
1717

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

20-
impl<'a> TryFrom<PlerkleAccountInfo<'a>> for AccountInfo {
20+
impl TryFrom<PlerkleAccountInfo<'_>> for AccountInfo {
2121
type Error = PlerkleDeserializerError;
2222

2323
fn try_from(value: PlerkleAccountInfo) -> Result<Self, Self::Error> {

nft_ingester/src/tasks/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ impl TaskManager {
324324
tokio::task::spawn(async move {
325325
while let Some(task) = receiver.recv().await {
326326
if let Some(task_created_time) = task.created_at {
327-
let bus_time =
328-
Utc::now().timestamp_millis() - task_created_time.timestamp_millis();
327+
let bus_time = Utc::now().timestamp_millis()
328+
- task_created_time.and_utc().timestamp_millis();
329329
metric! {
330330
statsd_histogram!("ingester.bgtask.bus_time", bus_time as u64, "type" => task.name);
331331
}

ops/src/bubblegum/tree.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ impl TreeGapFill {
171171
}
172172

173173
#[derive(Debug, Clone)]
174+
#[allow(dead_code)]
174175
pub struct TreeHeaderResponse {
175176
pub max_depth: u32,
176177
pub max_buffer_size: u32,
@@ -196,6 +197,7 @@ impl TryFrom<ConcurrentMerkleTreeHeader> for TreeHeaderResponse {
196197
#[derive(Debug, Clone)]
197198
pub struct TreeResponse {
198199
pub pubkey: Pubkey,
200+
#[allow(dead_code)]
199201
pub tree_header: TreeHeaderResponse,
200202
pub seq: u64,
201203
}

program_transformers/src/bubblegum/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ where
529529
pub async fn upsert_asset_creators<T>(
530530
txn: &T,
531531
id: Vec<u8>,
532-
creators: &Vec<Creator>,
532+
creators: &[Creator],
533533
slot_updated: i64,
534534
seq: i64,
535535
) -> ProgramTransformerResult<()>

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[toolchain]
2-
channel = "1.75.0"
2+
channel = "1.79.0"
33
components = ["clippy", "rustfmt"]
44
targets = []
55
profile = "minimal"

0 commit comments

Comments
 (0)