mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-29 11:51:31 +03:00
Simplify
This commit is contained in:
@@ -269,8 +269,8 @@ fn new(pos: u32) -> Marker {
|
||||
pub(crate) fn complete(mut self, p: &mut Parser, kind: SyntaxKind) -> CompletedMarker {
|
||||
self.bomb.defuse();
|
||||
let idx = self.pos as usize;
|
||||
match p.events[idx] {
|
||||
Event::Start { kind: ref mut slot, .. } => {
|
||||
match &mut p.events[idx] {
|
||||
Event::Start { kind: slot, .. } => {
|
||||
*slot = kind;
|
||||
}
|
||||
_ => unreachable!(),
|
||||
@@ -320,8 +320,8 @@ fn new(start_pos: u32, finish_pos: u32, kind: SyntaxKind) -> Self {
|
||||
pub(crate) fn precede(self, p: &mut Parser) -> Marker {
|
||||
let new_pos = p.start();
|
||||
let idx = self.start_pos as usize;
|
||||
match p.events[idx] {
|
||||
Event::Start { ref mut forward_parent, .. } => {
|
||||
match &mut p.events[idx] {
|
||||
Event::Start { forward_parent, .. } => {
|
||||
*forward_parent = Some(new_pos.pos - self.start_pos);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
@@ -333,12 +333,12 @@ pub(crate) fn precede(self, p: &mut Parser) -> Marker {
|
||||
pub(crate) fn undo_completion(self, p: &mut Parser) -> Marker {
|
||||
let start_idx = self.start_pos as usize;
|
||||
let finish_idx = self.finish_pos as usize;
|
||||
match p.events[start_idx] {
|
||||
Event::Start { ref mut kind, forward_parent: None } => *kind = TOMBSTONE,
|
||||
match &mut p.events[start_idx] {
|
||||
Event::Start { kind, forward_parent: None } => *kind = TOMBSTONE,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
match p.events[finish_idx] {
|
||||
ref mut slot @ Event::Finish => *slot = Event::tombstone(),
|
||||
match &mut p.events[finish_idx] {
|
||||
slot @ Event::Finish => *slot = Event::tombstone(),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
Marker::new(self.start_pos)
|
||||
|
||||
Reference in New Issue
Block a user