aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-09-04 17:00:01 +0100
committerAleksey Kladov <[email protected]>2018-09-04 17:00:01 +0100
commit8b0210d23367efecbf6e8ee9f19f372ff7d4fad3 (patch)
tree702b309b112158ed33fdf765546bdc52f8b9aa2e /crates/libsyntax2/src
parent8ed06d766f5b3bf42916b30f52c97ca2478128bf (diff)
simplify
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r--crates/libsyntax2/src/yellow/red.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/libsyntax2/src/yellow/red.rs b/crates/libsyntax2/src/yellow/red.rs
index 1ee6bdf18..84cfe4fba 100644
--- a/crates/libsyntax2/src/yellow/red.rs
+++ b/crates/libsyntax2/src/yellow/red.rs
@@ -56,13 +56,13 @@ impl RedNode {
56 } 56 }
57 57
58 fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode { 58 fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode {
59 let start_offset = parent.as_ref().map(|it| it.start_offset).unwrap_or(0.into()); 59 let mut start_offset = parent.as_ref().map(|it| it.start_offset).unwrap_or(0.into());
60 let children = green.children() 60 let children = green.children()
61 .iter() 61 .iter()
62 .scan(start_offset, |start_offset, child| { 62 .map(|child| {
63 let res = RedChild::Zigot(*start_offset); 63 let off = start_offset;
64 *start_offset += child.text_len(); 64 start_offset += child.text_len();
65 Some(res) 65 RedChild::Zigot(off)
66 }) 66 })
67 .collect::<Vec<_>>() 67 .collect::<Vec<_>>()
68 .into_boxed_slice(); 68 .into_boxed_slice();