diff options
author | Aleksey Kladov <[email protected]> | 2020-04-24 23:57:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-25 10:59:18 +0100 |
commit | 63a462f37ca584e1a585a69e30823ce25d4d252f (patch) | |
tree | 005ab4d5b50f7d031be9f4056bd1fccd68473587 /crates/ra_mbe | |
parent | dc2151085e9b117bc87307bf47edf3d17a170b49 (diff) |
Switch to TryFrom
Diffstat (limited to 'crates/ra_mbe')
-rw-r--r-- | crates/ra_mbe/src/syntax_bridge.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index fa9787266..bb28acfd9 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs | |||
@@ -516,7 +516,7 @@ impl TokenConvertor for Convertor { | |||
516 | fn bump(&mut self) -> Option<(Self::Token, TextRange)> { | 516 | fn bump(&mut self) -> Option<(Self::Token, TextRange)> { |
517 | if let Some((punct, offset)) = self.punct_offset.clone() { | 517 | if let Some((punct, offset)) = self.punct_offset.clone() { |
518 | if usize::from(offset) + 1 < punct.text().len() { | 518 | if usize::from(offset) + 1 < punct.text().len() { |
519 | let offset = offset + TextSize::from_usize(1); | 519 | let offset = offset + TextSize::of('.'); |
520 | let range = punct.text_range(); | 520 | let range = punct.text_range(); |
521 | self.punct_offset = Some((punct.clone(), offset)); | 521 | self.punct_offset = Some((punct.clone(), offset)); |
522 | let range = TextRange::at(range.start() + offset, TextSize::of('.')); | 522 | let range = TextRange::at(range.start() + offset, TextSize::of('.')); |
@@ -532,9 +532,9 @@ impl TokenConvertor for Convertor { | |||
532 | 532 | ||
533 | let token = if curr.kind().is_punct() { | 533 | let token = if curr.kind().is_punct() { |
534 | let range = curr.text_range(); | 534 | let range = curr.text_range(); |
535 | let range = TextRange::at(range.start(), TextSize::from_usize(1)); | 535 | let range = TextRange::at(range.start(), TextSize::of('.')); |
536 | self.punct_offset = Some((curr.clone(), TextSize::from_usize(0))); | 536 | self.punct_offset = Some((curr.clone(), 0.into())); |
537 | (SynToken::Punch(curr, TextSize::from_usize(0)), range) | 537 | (SynToken::Punch(curr, 0.into()), range) |
538 | } else { | 538 | } else { |
539 | self.punct_offset = None; | 539 | self.punct_offset = None; |
540 | let range = curr.text_range(); | 540 | let range = curr.text_range(); |
@@ -546,7 +546,7 @@ impl TokenConvertor for Convertor { | |||
546 | 546 | ||
547 | fn peek(&self) -> Option<Self::Token> { | 547 | fn peek(&self) -> Option<Self::Token> { |
548 | if let Some((punct, mut offset)) = self.punct_offset.clone() { | 548 | if let Some((punct, mut offset)) = self.punct_offset.clone() { |
549 | offset = offset + TextSize::from_usize(1); | 549 | offset = offset + TextSize::of('.'); |
550 | if usize::from(offset) < punct.text().len() { | 550 | if usize::from(offset) < punct.text().len() { |
551 | return Some(SynToken::Punch(punct, offset)); | 551 | return Some(SynToken::Punch(punct, offset)); |
552 | } | 552 | } |
@@ -558,7 +558,7 @@ impl TokenConvertor for Convertor { | |||
558 | } | 558 | } |
559 | 559 | ||
560 | let token = if curr.kind().is_punct() { | 560 | let token = if curr.kind().is_punct() { |
561 | SynToken::Punch(curr, TextSize::from_usize(0)) | 561 | SynToken::Punch(curr, 0.into()) |
562 | } else { | 562 | } else { |
563 | SynToken::Ordiniary(curr) | 563 | SynToken::Ordiniary(curr) |
564 | }; | 564 | }; |