mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-21 09:40:13 +00:00
Reformat all
This commit is contained in:
parent
857c1650ef
commit
6be50f7d5d
35 changed files with 423 additions and 367 deletions
|
@ -89,7 +89,6 @@ pub fn add_cursor(text: &str, offset: TextUnit) -> String {
|
|||
res
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FixtureEntry {
|
||||
pub meta: String,
|
||||
|
@ -112,25 +111,29 @@ pub fn parse_fixture(fixture: &str) -> Vec<FixtureEntry> {
|
|||
macro_rules! flush {
|
||||
() => {
|
||||
if let Some(meta) = meta {
|
||||
res.push(FixtureEntry { meta: meta.to_string(), text: buf.clone() });
|
||||
res.push(FixtureEntry {
|
||||
meta: meta.to_string(),
|
||||
text: buf.clone(),
|
||||
});
|
||||
buf.clear();
|
||||
}
|
||||
};
|
||||
};
|
||||
let margin = fixture.lines()
|
||||
let margin = fixture
|
||||
.lines()
|
||||
.filter(|it| it.trim_start().starts_with("//-"))
|
||||
.map(|it| it.len() - it.trim_start().len())
|
||||
.next().expect("empty fixture");
|
||||
let lines = fixture.lines()
|
||||
.filter_map(|line| {
|
||||
if line.len() >= margin {
|
||||
assert!(line[..margin].trim().is_empty());
|
||||
Some(&line[margin..])
|
||||
} else {
|
||||
assert!(line.trim().is_empty());
|
||||
None
|
||||
}
|
||||
});
|
||||
.next()
|
||||
.expect("empty fixture");
|
||||
let lines = fixture.lines().filter_map(|line| {
|
||||
if line.len() >= margin {
|
||||
assert!(line[..margin].trim().is_empty());
|
||||
Some(&line[margin..])
|
||||
} else {
|
||||
assert!(line.trim().is_empty());
|
||||
None
|
||||
}
|
||||
});
|
||||
|
||||
for line in lines {
|
||||
if line.starts_with("//-") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue