mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
simplify
This commit is contained in:
parent
8ed06d766f
commit
8b0210d233
1 changed files with 5 additions and 5 deletions
|
@ -56,13 +56,13 @@ impl RedNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode {
|
fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode {
|
||||||
let start_offset = parent.as_ref().map(|it| it.start_offset).unwrap_or(0.into());
|
let mut start_offset = parent.as_ref().map(|it| it.start_offset).unwrap_or(0.into());
|
||||||
let children = green.children()
|
let children = green.children()
|
||||||
.iter()
|
.iter()
|
||||||
.scan(start_offset, |start_offset, child| {
|
.map(|child| {
|
||||||
let res = RedChild::Zigot(*start_offset);
|
let off = start_offset;
|
||||||
*start_offset += child.text_len();
|
start_offset += child.text_len();
|
||||||
Some(res)
|
RedChild::Zigot(off)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.into_boxed_slice();
|
.into_boxed_slice();
|
||||||
|
|
Loading…
Reference in a new issue