Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodesdev committed Jun 8, 2024
1 parent 732b079 commit 0c06cb2
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions crates/syntest/src/syntest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,6 @@ impl Syntest {
})
}

pub fn expr<F>(&self, mut handler: F)
where
F: FnMut(&Expr),
{
self.file.items.iter().for_each(|item| {
let mut ran = false;
if let Item::Fn(f) = item {
f.block.stmts.iter().for_each(|stmt| {
if let Stmt::Expr(expr, _) = stmt {
handler(expr);
ran = true;
}
})
}

if !ran {
panic!("No expression found");
}
})
}

pub fn func<F>(&self, fn_name: &str, mut handler: F)
where
F: FnMut(&ItemFn),
Expand Down Expand Up @@ -77,7 +56,7 @@ impl Syntest {
});

if !ran {
panic!("Function {} not found", fn_name);
panic!("No statements found for function {}", fn_name);
}
}

Expand Down

0 comments on commit 0c06cb2

Please sign in to comment.