Skip to content

Commit

Permalink
Run nightly rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Dec 11, 2023
1 parent d2fc9aa commit 923882a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions crates/edr_solidity/src/contracts_identifier.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
mod radix_tree;

use std::collections::hash_map::DefaultHasher;
use std::collections::HashMap;
use std::hash::{Hash, Hasher};
use std::{
collections::{hash_map::DefaultHasher, HashMap},
hash::{Hash, Hasher},
};

use radix_tree::RadixTree;

Expand Down
9 changes: 6 additions & 3 deletions crates/edr_solidity/src/contracts_identifier/radix_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ impl RadixNode {

let b = word[0];

// we temporarily remove the next node and then insert it back, possibly mutated and/or in a different position
// we temporarily remove the next node and then insert it back, possibly mutated
// and/or in a different position
let next_node = self.child_nodes.remove(&b);

match next_node {
Expand Down Expand Up @@ -89,7 +90,8 @@ impl RadixNode {
self.bytes_matched_before + self.content.len(),
);

// next_node should come after middle_node and its content and bytes_matched_before need to be adapted
// next_node should come after middle_node and its content and
// bytes_matched_before need to be adapted
next_node.content = next_node.content[prefix_length..].to_vec();
next_node.bytes_matched_before +=
middle_node.bytes_matched_before + middle_node.content.len();
Expand Down Expand Up @@ -118,7 +120,8 @@ impl RadixNode {
* - a boolean indicating if the word was matched exactly
* - the number of bytes matched
* - the node that matched the word
* If the word is not matched exactly, the node will be the one that matched the longest prefix.
* If the word is not matched exactly, the node will be the one that
* matched the longest prefix.
*/
fn get_max_match(&self, word: &[u8]) -> (bool, usize, &RadixNode) {
let prefix_length = get_shared_prefix_length(word, &self.content);
Expand Down

0 comments on commit 923882a

Please sign in to comment.