Use boxed sliced for red nodes

This commit is contained in:
Aleksey Kladov 2018-07-30 18:14:14 +03:00
parent beaddb4780
commit 6fc66c4ee6
2 changed files with 4 additions and 3 deletions

View File

@ -150,6 +150,5 @@ Grammar(
"LIFETIME_PARAM",
"TYPE_PARAM_LIST",
"TYPE_ARG_LIST",
]
)

View File

@ -5,7 +5,7 @@ use {yellow::GreenNode, TextUnit};
pub(crate) struct RedNode {
green: GreenNode,
parent: Option<ParentData>,
children: RwLock<Vec<Option<RedNode>>>,
children: RwLock<Box<[Option<RedNode>]>>,
}
#[derive(Debug)]
@ -36,7 +36,9 @@ impl RedNode {
fn new(green: GreenNode, parent: Option<ParentData>) -> RedNode {
let n_children = green.children().len();
let children = (0..n_children).map(|_| None).collect();
let children = (0..n_children).map(|_| None)
.collect::<Vec<_>>()
.into_boxed_slice();
RedNode {
green,
parent,