From 5e1ae1d7aa9d83406de4881be37b39ed457e3bda Mon Sep 17 00:00:00 2001 From: Veetaha Date: Wed, 29 Jan 2020 03:53:15 +0200 Subject: test_utils: move flush!() to its usage as per conversation with @matklad --- crates/test_utils/src/lib.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'crates/test_utils') diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index 87778fd04..265fcf8da 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs @@ -169,19 +169,6 @@ pub struct FixtureEntry { /// // - other meta /// ``` pub fn parse_fixture(fixture: &str) -> Vec { - let mut res = Vec::new(); - let mut buf = String::new(); - let mut meta: Option<&str> = None; - - macro_rules! flush { - () => { - if let Some(meta) = meta { - res.push(FixtureEntry { meta: meta.to_string(), text: buf.clone() }); - buf.clear(); - } - }; - }; - let margin = fixture .lines() .filter(|it| it.trim_start().starts_with("//-")) @@ -201,6 +188,19 @@ pub fn parse_fixture(fixture: &str) -> Vec { } }); + let mut res = Vec::new(); + let mut buf = String::new(); + let mut meta: Option<&str> = None; + + macro_rules! flush { + () => { + if let Some(meta) = meta { + res.push(FixtureEntry { meta: meta.to_string(), text: buf.clone() }); + buf.clear(); + } + }; + }; + for line in lines { if line.starts_with("//-") { flush!(); -- cgit v1.2.3