mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-31 15:47:31 +00:00
Simplify
This commit is contained in:
parent
21f751a0e5
commit
3486b47e5c
3 changed files with 14 additions and 71 deletions
|
@ -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
|
||||
|
|
|
@ -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 = "<|>";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue