Skip to content

Commit

Permalink
fix: fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rex4539 committed Jan 22, 2025
1 parent 559b654 commit 2c9cac2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/cli/src/parse/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(crate) async fn parse_blocks(
for path in files {
let column = if path.contains(':') {
path.split(':')
.last()
.next_back()
.ok_or(ParseError::ParseError("could not parse txs path column".to_string()))?
} else {
"block_number"
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/parse/timestamps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(crate) async fn parse_timestamps(
for path in files {
let column = if path.contains(':') {
path.split(':')
.last()
.next_back()
.ok_or(ParseError::ParseError("could not parse txs path column".to_string()))?
} else {
"timestamp"
Expand Down
2 changes: 1 addition & 1 deletion crates/freeze/src/datasets/address_appearances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl CollectByTransaction for AddressAppearances {
fn name(log: &Log) -> Option<&'static str> {
let event = log.topic0().unwrap();
if event == *ERC20::Transfer::SIGNATURE_HASH {
if log.data().data.len() > 0 {
if !log.data().data.is_empty() {
Some("erc20_transfer")
} else if log.topics().len() == 4 {
Some("erc721_transfer")
Expand Down
4 changes: 2 additions & 2 deletions crates/freeze/src/datasets/erc721_transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl CollectByBlock for Erc721Transfers {
let filter = Filter { topics, ..request.ethers_log_filter()? };
let logs = source.get_logs(&filter).await?;

Ok(logs.into_iter().filter(|x| x.topics().len() == 4 && x.data().data.len() == 0).collect())
Ok(logs.into_iter().filter(|x| x.topics().len() == 4 && x.data().data.is_empty()).collect())
}

fn transform(response: Self::Response, columns: &mut Self, query: &Arc<Query>) -> R<()> {
Expand All @@ -97,7 +97,7 @@ impl CollectByTransaction for Erc721Transfers {

fn is_erc721_transfer(log: &Log) -> bool {
log.topics().len() == 4 &&
log.data().data.len() == 0 &&
log.data().data.is_empty() &&
log.topics()[0] == ERC721::Transfer::SIGNATURE_HASH
}

Expand Down
18 changes: 12 additions & 6 deletions crates/freeze/src/types/execution.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use crate::CollectError;
use indicatif::ProgressBar;
use std::{path::PathBuf, sync::Arc, time::SystemTime};
use std::{
path::PathBuf,
sync::Arc,
time::{Duration, SystemTime},
};

/// configuration of execution environment
#[derive(Clone)]
Expand Down Expand Up @@ -47,11 +51,13 @@ impl Default for ExecutionEnv {

fn new_bar(n: u64) -> Result<Arc<ProgressBar>, CollectError> {
let bar = Arc::new(ProgressBar::new(n));
bar.set_style(
indicatif::ProgressStyle::default_bar()
.template("{wide_msg} ⏳ = {eta_precise} \n{wide_bar:.green} {human_pos} / {human_len} ⌛ = {elapsed_precise} ")
.map_err(|_| CollectError::CollectError("error creating progress bar".to_string()))?,
);
let style = indicatif::ProgressStyle::default_bar()
.template("{wide_msg} ⏳ = {eta_precise}\n{wide_bar} \x1b[32m{human_pos}/{human_len}\x1b[0m ⌛ = {elapsed_precise}")
.map_err(|_| CollectError::CollectError("error creating progress bar".to_string()))?
.progress_chars("█▉▊▋▌▍▎▏ "); // Customize progress characters

bar.set_style(style);
bar.enable_steady_tick(Duration::from_millis(100)); // Tick interval of 100ms
Ok(bar)
}

Expand Down

0 comments on commit 2c9cac2

Please sign in to comment.