mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
test_utils: move flush!() to its usage as per conversation with @matklad
This commit is contained in:
parent
d3472e8ae4
commit
5e1ae1d7aa
1 changed files with 13 additions and 13 deletions
|
@ -169,19 +169,6 @@ pub struct FixtureEntry {
|
|||
/// // - other meta
|
||||
/// ```
|
||||
pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> {
|
||||
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<FixtureEntry> {
|
|||
}
|
||||
});
|
||||
|
||||
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!();
|
||||
|
|
Loading…
Reference in a new issue