Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ewoolsey committed Oct 24, 2024
1 parent 45884e1 commit 3c50d2f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/trees/src/cascading/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ where
for subtree_power in first_subtree_power..=last_subtree_power {
// We have a special case for subtree_power = 0
// because the subtree is completely empty.
// This represents the very borrow left of the tree.
// This represents the very bottom left of the tree.
// parent_index represents the index of the parent node of the subtree.
// It is the power of two on the left most branch of the tree.
let parent_index = if subtree_power == 0 {
Expand Down
14 changes: 7 additions & 7 deletions examples/abort/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ static INITIAL_LEAVES: usize = 10;
/// is successful
///
/// Run this binary with no arguments to run the tests
fn main() -> Result<()> {
/// `RUSTFLAGS="-C panic=abort" cargo run --example abort`
#[tokio::main]
async fn main() -> Result<()> {
let args: Vec<String> = env::args().collect();

// initialize
Expand Down Expand Up @@ -63,9 +65,7 @@ fn run_test(prefix: &str) -> Result<u32> {
let stdout = String::from_utf8(output.stdout)?;
print!("{}", stdout);
let stderr = String::from_utf8(output.stderr)?;
if !stderr.is_empty() {
panic!("{}", stderr);
}
print!("{}", stderr);

let output = std::process::Command::new(BIN_PATH)
.arg(format!("{prefix}_restore"))
Expand Down Expand Up @@ -97,7 +97,7 @@ fn cascade_init() -> Result<()> {
&leaves,
);

let _handle = std::thread::spawn(move || {
let _handle = tokio::spawn(async move {
for _ in 0..15 {
tree.push(U256::from(2)).unwrap();
}
Expand All @@ -107,7 +107,7 @@ fn cascade_init() -> Result<()> {
let millis: u64 = rng.gen_range(0..50);
std::thread::sleep(std::time::Duration::from_millis(millis));

Ok(())
panic!("");
}

fn cascade_restore() -> Result<()> {
Expand Down Expand Up @@ -145,7 +145,7 @@ fn lazy_init() -> Result<()> {
let millis: u64 = rng.gen_range(0..50);
std::thread::sleep(std::time::Duration::from_millis(millis));

Ok(())
panic!("");
}

fn lazy_restore() -> Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub(crate) fn deserialize_bytes<'de, const N: usize, D: Deserializer<'de>>(
) -> Result<[u8; N], D::Error> {
if deserializer.is_human_readable() {
struct StrVisitor<const N: usize>;
impl<'de, const N: usize> Visitor<'de> for StrVisitor<N> {
impl<const N: usize> Visitor<'_> for StrVisitor<N> {
type Value = [u8; N];

fn expecting(&self, formatter: &mut Formatter) -> FmtResult {
Expand All @@ -86,7 +86,7 @@ pub(crate) fn deserialize_bytes<'de, const N: usize, D: Deserializer<'de>>(
deserializer.deserialize_str(StrVisitor)
} else {
struct ByteVisitor<const N: usize>;
impl<'de, const N: usize> Visitor<'de> for ByteVisitor<N> {
impl<const N: usize> Visitor<'_> for ByteVisitor<N> {
type Value = [u8; N];

fn expecting(&self, formatter: &mut Formatter) -> FmtResult {
Expand Down

0 comments on commit 3c50d2f

Please sign in to comment.