mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
Simplify
This commit is contained in:
parent
91fb7e2088
commit
3c612bfa3a
2 changed files with 4 additions and 3 deletions
|
@ -49,9 +49,7 @@ fn item(p: &mut Parser) -> bool {
|
||||||
|| node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item)
|
|| node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item)
|
||||||
|| node_if(p, FN_KW, FN_ITEM, fn_item);
|
|| node_if(p, FN_KW, FN_ITEM, fn_item);
|
||||||
|
|
||||||
if item_parsed && attrs_start != item_start {
|
p.forward_parent(attrs_start, item_start);
|
||||||
p.forward_parent(attrs_start, item_start);
|
|
||||||
}
|
|
||||||
item_parsed
|
item_parsed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,9 @@ impl<'t> Parser<'t> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn forward_parent(&mut self, child: Mark, parent: Mark) {
|
pub(crate) fn forward_parent(&mut self, child: Mark, parent: Mark) {
|
||||||
|
if child == parent || parent == self.mark() {
|
||||||
|
return
|
||||||
|
}
|
||||||
assert!(child.0 < parent.0);
|
assert!(child.0 < parent.0);
|
||||||
let diff = parent.0 - child.0;
|
let diff = parent.0 - child.0;
|
||||||
match self.events[child.0 as usize] {
|
match self.events[child.0 as usize] {
|
||||||
|
|
Loading…
Reference in a new issue