Skip to content

Commit

Permalink
chore(node): add workspace lints
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gilad Chase committed Nov 5, 2024
1 parent 92e7432 commit a9ec62e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions crates/papyrus_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions crates/papyrus_node/examples/get_transaction_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -79,7 +79,7 @@ fn get_cli_params() -> CliParams {
let concurrent_requests = matches
.get_one::<String>("concurrent_requests")
.expect("Failed parsing concurrent_requests")
.parse::<u64>()
.parse::<usize>()
.expect("Failed parsing concurrent_requests");
let deprecated = matches
.get_one::<String>("deprecated")
Expand Down Expand Up @@ -156,7 +156,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.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();
Expand Down

0 comments on commit a9ec62e

Please sign in to comment.