Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sslivkoff committed Aug 1, 2023
1 parent af17ad5 commit c6f725b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion crates/cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ pub struct Args {
long,
default_value = "0:latest",
allow_hyphen_values(true),
help_heading = "Content Options"
help_heading = "Content Options",
num_args = 1..
)]
pub blocks: Vec<String>,

Expand Down
2 changes: 1 addition & 1 deletion crates/freeze/src/datasets/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub(crate) async fn blocks_to_dfs<TX: ProcessTransactions>(
}
Err(e) => {
println!("{:?}", e);
return Err(CollectError::TooManyRequestsError);
return Err(CollectError::TooManyRequestsError)
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions crates/freeze/src/datasets/blocks_and_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ async fn get_txs_gas_used(
block: &Block<Transaction>,
source: Arc<Source>,
) -> Result<Vec<u32>, CollectError> {

let source = Arc::new(source);
let mut tasks = Vec::new();
for tx in &block.transactions {
Expand All @@ -128,7 +127,9 @@ async fn get_txs_gas_used(
};
match provider.get_transaction_receipt(tx_clone).await {
Ok(Some(receipt)) => Ok(receipt.gas_used),
Ok(None) => Err(CollectError::CollectError("could not find tx receipt".to_string())),
Ok(None) => {
Err(CollectError::CollectError("could not find tx receipt".to_string()))
}
Err(e) => Err(CollectError::ProviderError(e)),
}
});
Expand All @@ -139,9 +140,7 @@ async fn get_txs_gas_used(
for task in tasks {
match task.await {
Ok(Ok(Some(value))) => gas_used.push(value.as_u32()),
_ => {
return Err(CollectError::CollectError("gas_used not available from node".into()))
},
_ => return Err(CollectError::CollectError("gas_used not available from node".into())),
}
}

Expand Down
6 changes: 4 additions & 2 deletions crates/freeze/src/types/schemas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,17 @@ fn compute_used_columns(
let mut result: Vec<String> = default_columns.iter().map(|s| s.to_string()).collect();
let mut result_set: HashSet<String> = result.iter().cloned().collect();
let exclude_set: HashSet<String> = exclude.iter().cloned().collect();
include.iter()
include
.iter()
.filter(|item| !exclude_set.contains(*item) && result_set.insert(item.to_string()))
.for_each(|item| result.push(item.clone()));
result
}
(_, Some(include), None) => {
let mut result: Vec<String> = default_columns.iter().map(|s| s.to_string()).collect();
let mut result_set: HashSet<String> = result.iter().cloned().collect();
include.iter()
include
.iter()
.filter(|item| result_set.insert(item.to_string()))
.for_each(|item| result.push(item.clone()));
result
Expand Down

0 comments on commit c6f725b

Please sign in to comment.