mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
Use boxed sliced for red nodes
This commit is contained in:
parent
beaddb4780
commit
6fc66c4ee6
2 changed files with 4 additions and 3 deletions
|
@ -150,6 +150,5 @@ Grammar(
|
|||
"LIFETIME_PARAM",
|
||||
"TYPE_PARAM_LIST",
|
||||
"TYPE_ARG_LIST",
|
||||
|
||||
]
|
||||
)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue