diff options
Diffstat (limited to 'crates/ra_parser')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions.rs | 1 | ||||
-rw-r--r-- | crates/ra_parser/src/parser.rs | 16 |
2 files changed, 8 insertions, 9 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index e1c25a838..51eaf7af6 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -509,7 +509,6 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | |||
509 | // x.1i32; | 509 | // x.1i32; |
510 | // x.0x01; | 510 | // x.0x01; |
511 | // } | 511 | // } |
512 | #[allow(clippy::if_same_then_else)] | ||
513 | fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | 512 | fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { |
514 | assert!(p.at(T![.])); | 513 | assert!(p.at(T![.])); |
515 | let m = lhs.precede(p); | 514 | let m = lhs.precede(p); |
diff --git a/crates/ra_parser/src/parser.rs b/crates/ra_parser/src/parser.rs index d797f2cc9..d2487acc3 100644 --- a/crates/ra_parser/src/parser.rs +++ b/crates/ra_parser/src/parser.rs | |||
@@ -269,8 +269,8 @@ impl Marker { | |||
269 | pub(crate) fn complete(mut self, p: &mut Parser, kind: SyntaxKind) -> CompletedMarker { | 269 | pub(crate) fn complete(mut self, p: &mut Parser, kind: SyntaxKind) -> CompletedMarker { |
270 | self.bomb.defuse(); | 270 | self.bomb.defuse(); |
271 | let idx = self.pos as usize; | 271 | let idx = self.pos as usize; |
272 | match p.events[idx] { | 272 | match &mut p.events[idx] { |
273 | Event::Start { kind: ref mut slot, .. } => { | 273 | Event::Start { kind: slot, .. } => { |
274 | *slot = kind; | 274 | *slot = kind; |
275 | } | 275 | } |
276 | _ => unreachable!(), | 276 | _ => unreachable!(), |
@@ -320,8 +320,8 @@ impl CompletedMarker { | |||
320 | pub(crate) fn precede(self, p: &mut Parser) -> Marker { | 320 | pub(crate) fn precede(self, p: &mut Parser) -> Marker { |
321 | let new_pos = p.start(); | 321 | let new_pos = p.start(); |
322 | let idx = self.start_pos as usize; | 322 | let idx = self.start_pos as usize; |
323 | match p.events[idx] { | 323 | match &mut p.events[idx] { |
324 | Event::Start { ref mut forward_parent, .. } => { | 324 | Event::Start { forward_parent, .. } => { |
325 | *forward_parent = Some(new_pos.pos - self.start_pos); | 325 | *forward_parent = Some(new_pos.pos - self.start_pos); |
326 | } | 326 | } |
327 | _ => unreachable!(), | 327 | _ => unreachable!(), |
@@ -333,12 +333,12 @@ impl CompletedMarker { | |||
333 | pub(crate) fn undo_completion(self, p: &mut Parser) -> Marker { | 333 | pub(crate) fn undo_completion(self, p: &mut Parser) -> Marker { |
334 | let start_idx = self.start_pos as usize; | 334 | let start_idx = self.start_pos as usize; |
335 | let finish_idx = self.finish_pos as usize; | 335 | let finish_idx = self.finish_pos as usize; |
336 | match p.events[start_idx] { | 336 | match &mut p.events[start_idx] { |
337 | Event::Start { ref mut kind, forward_parent: None } => *kind = TOMBSTONE, | 337 | Event::Start { kind, forward_parent: None } => *kind = TOMBSTONE, |
338 | _ => unreachable!(), | 338 | _ => unreachable!(), |
339 | } | 339 | } |
340 | match p.events[finish_idx] { | 340 | match &mut p.events[finish_idx] { |
341 | ref mut slot @ Event::Finish => *slot = Event::tombstone(), | 341 | slot @ Event::Finish => *slot = Event::tombstone(), |
342 | _ => unreachable!(), | 342 | _ => unreachable!(), |
343 | } | 343 | } |
344 | Marker::new(self.start_pos) | 344 | Marker::new(self.start_pos) |