From 0c06cb2c7b3bcd7131f20cb9cde8a1c943203934 Mon Sep 17 00:00:00 2001 From: dcodesdev <101001810+dcodesdev@users.noreply.github.com> Date: Sat, 8 Jun 2024 11:03:10 +0300 Subject: [PATCH] refactor --- crates/syntest/src/syntest.rs | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/crates/syntest/src/syntest.rs b/crates/syntest/src/syntest.rs index e6c7264..e599b53 100644 --- a/crates/syntest/src/syntest.rs +++ b/crates/syntest/src/syntest.rs @@ -24,27 +24,6 @@ impl Syntest { }) } - pub fn expr(&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(&self, fn_name: &str, mut handler: F) where F: FnMut(&ItemFn), @@ -77,7 +56,7 @@ impl Syntest { }); if !ran { - panic!("Function {} not found", fn_name); + panic!("No statements found for function {}", fn_name); } }