Skip to content

Commit

Permalink
lint: clippy + fmt + use expect over unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
whichqua committed Oct 1, 2024
1 parent 058691b commit 4389fe2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ impl ChainId {
pub fn as_str(&self) -> &str {
std::str::from_utf8(self.0.as_be_bytes())
.expect("valid utf8")
.trim_start_matches(|c| c == '\0')
.trim_start_matches('\0')
}

pub const MAINNET: Self = Self::from_slice_unwrap(b"SN_MAIN");
Expand Down
9 changes: 7 additions & 2 deletions crates/merkle-tree/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ use bitvec::slice::BitSlice;
use pathfinder_common::hash::PedersenHash;
use pathfinder_common::trie::TrieNode;
use pathfinder_common::{
BlockNumber, ContractAddress, ContractRoot, ContractStateHash, StorageAddress,
StorageCommitment, StorageValue,
BlockNumber,
ContractAddress,
ContractRoot,
ContractStateHash,
StorageAddress,
StorageCommitment,
StorageValue,
};
use pathfinder_crypto::Felt;
use pathfinder_storage::{Transaction, TrieUpdate};
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/src/pathfinder/methods/get_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ pub async fn get_proof(
input.contract_address,
header.number,
k.view_bits(),
root.unwrap()
root.expect("Root cannot be empty"),
)
.context("Get proof from contract state tree")?
.ok_or_else(|| {
Expand Down

0 comments on commit 4389fe2

Please sign in to comment.