This commit is contained in:
Aleksey Kladov 2020-06-23 18:43:55 +02:00
parent 21f751a0e5
commit 3486b47e5c
3 changed files with 14 additions and 71 deletions

View file

@ -13,19 +13,6 @@ pub struct FixtureEntry {
pub env: FxHashMap<String, String>,
}
/// Same as `parse_fixture`, except it allow empty fixture
pub fn parse_single_fixture(ra_fixture: &str) -> Option<FixtureEntry> {
if !ra_fixture.lines().any(|it| it.trim_start().starts_with("//-")) {
return None;
}
let fixtures = parse_fixture(ra_fixture);
if fixtures.len() > 1 {
panic!("too many fixtures");
}
fixtures.into_iter().nth(0)
}
/// Parses text which looks like this:
///
/// ```not_rust

View file

@ -22,7 +22,7 @@ pub use difference::Changeset as __Changeset;
pub use ra_cfg::CfgOptions;
pub use rustc_hash::FxHashMap;
pub use crate::fixture::{parse_fixture, parse_single_fixture, FixtureEntry};
pub use crate::fixture::{parse_fixture, FixtureEntry};
pub const CURSOR_MARKER: &str = "<|>";