mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Merge #5715
5715: Simplify
r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
b93408d0b2
1 changed files with 8 additions and 8 deletions
|
@ -269,8 +269,8 @@ impl Marker {
|
||||||
pub(crate) fn complete(mut self, p: &mut Parser, kind: SyntaxKind) -> CompletedMarker {
|
pub(crate) fn complete(mut self, p: &mut Parser, kind: SyntaxKind) -> CompletedMarker {
|
||||||
self.bomb.defuse();
|
self.bomb.defuse();
|
||||||
let idx = self.pos as usize;
|
let idx = self.pos as usize;
|
||||||
match p.events[idx] {
|
match &mut p.events[idx] {
|
||||||
Event::Start { kind: ref mut slot, .. } => {
|
Event::Start { kind: slot, .. } => {
|
||||||
*slot = kind;
|
*slot = kind;
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
@ -320,8 +320,8 @@ impl CompletedMarker {
|
||||||
pub(crate) fn precede(self, p: &mut Parser) -> Marker {
|
pub(crate) fn precede(self, p: &mut Parser) -> Marker {
|
||||||
let new_pos = p.start();
|
let new_pos = p.start();
|
||||||
let idx = self.start_pos as usize;
|
let idx = self.start_pos as usize;
|
||||||
match p.events[idx] {
|
match &mut p.events[idx] {
|
||||||
Event::Start { ref mut forward_parent, .. } => {
|
Event::Start { forward_parent, .. } => {
|
||||||
*forward_parent = Some(new_pos.pos - self.start_pos);
|
*forward_parent = Some(new_pos.pos - self.start_pos);
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
|
@ -333,12 +333,12 @@ impl CompletedMarker {
|
||||||
pub(crate) fn undo_completion(self, p: &mut Parser) -> Marker {
|
pub(crate) fn undo_completion(self, p: &mut Parser) -> Marker {
|
||||||
let start_idx = self.start_pos as usize;
|
let start_idx = self.start_pos as usize;
|
||||||
let finish_idx = self.finish_pos as usize;
|
let finish_idx = self.finish_pos as usize;
|
||||||
match p.events[start_idx] {
|
match &mut p.events[start_idx] {
|
||||||
Event::Start { ref mut kind, forward_parent: None } => *kind = TOMBSTONE,
|
Event::Start { kind, forward_parent: None } => *kind = TOMBSTONE,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
match p.events[finish_idx] {
|
match &mut p.events[finish_idx] {
|
||||||
ref mut slot @ Event::Finish => *slot = Event::tombstone(),
|
slot @ Event::Finish => *slot = Event::tombstone(),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
Marker::new(self.start_pos)
|
Marker::new(self.start_pos)
|
||||||
|
|
Loading…
Reference in a new issue