From edf9ecd000985bf319f0a6497f5e213b8b688001 Mon Sep 17 00:00:00 2001 From: Gilad Chase Date: Tue, 5 Nov 2024 14:13:56 +0200 Subject: [PATCH] chore(node): add workspace lints Lior banned `as` repo-wide, unless absolutely necessary. Nearly all as uses can be replaced with [Try]From which doesn't have implicit coercions like as (we encountered several bugs due to these coercions). Motivation: we are standardizing lints across the repo and CI, instead of each crate having separate sets of lints. --- crates/papyrus_node/Cargo.toml | 6 ++---- crates/papyrus_node/examples/get_transaction_hash.rs | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/papyrus_node/Cargo.toml b/crates/papyrus_node/Cargo.toml index 762c113a54..0304ce2280 100644 --- a/crates/papyrus_node/Cargo.toml +++ b/crates/papyrus_node/Cargo.toml @@ -67,7 +67,5 @@ papyrus_test_utils.workspace = true pretty_assertions.workspace = true tempfile.workspace = true -[lints.rust] -# See [here](https://github.com/taiki-e/cargo-llvm-cov/issues/370) for a discussion on why this is -# needed (from rust 1.80). -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } +[lints] +workspace = true diff --git a/crates/papyrus_node/examples/get_transaction_hash.rs b/crates/papyrus_node/examples/get_transaction_hash.rs index 6cd4b0ed2f..fce8f48485 100644 --- a/crates/papyrus_node/examples/get_transaction_hash.rs +++ b/crates/papyrus_node/examples/get_transaction_hash.rs @@ -22,7 +22,7 @@ struct CliParams { iteration_increments: u64, file_path: String, deprecated: bool, - concurrent_requests: u64, + concurrent_requests: usize, } /// The start_block and end_block arguments are mandatory and define the block range to dump, @@ -79,7 +79,7 @@ fn get_cli_params() -> CliParams { let concurrent_requests = matches .get_one::("concurrent_requests") .expect("Failed parsing concurrent_requests") - .parse::() + .parse::() .expect("Failed parsing concurrent_requests"); let deprecated = matches .get_one::("deprecated") @@ -156,7 +156,7 @@ async fn main() -> Result<(), Box> { .lock() .expect("Couldn't lock transaction types") .is_empty() - && handles.len() < concurrent_requests as usize + && handles.len() < concurrent_requests { let client_ref = client.clone(); let node_url_ref = node_url.clone();