diff options
Diffstat (limited to 'crates/ra_parser')
-rw-r--r-- | crates/ra_parser/src/grammar.rs | 5 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/paths.rs | 5 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/type_params.rs | 5 | ||||
-rw-r--r-- | crates/ra_parser/src/syntax_kind.rs | 5 |
4 files changed, 4 insertions, 16 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 293baecf6..caedeead0 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -73,10 +73,7 @@ pub(crate) mod fragments { | |||
73 | // Parse a meta item , which excluded [], e.g : #[ MetaItem ] | 73 | // Parse a meta item , which excluded [], e.g : #[ MetaItem ] |
74 | pub(crate) fn meta_item(p: &mut Parser) { | 74 | pub(crate) fn meta_item(p: &mut Parser) { |
75 | fn is_delimiter(p: &mut Parser) -> bool { | 75 | fn is_delimiter(p: &mut Parser) -> bool { |
76 | match p.current() { | 76 | matches!(p.current(), T!['{'] | T!['('] | T!['[']) |
77 | T!['{'] | T!['('] | T!['['] => true, | ||
78 | _ => false, | ||
79 | } | ||
80 | } | 77 | } |
81 | 78 | ||
82 | if is_delimiter(p) { | 79 | if is_delimiter(p) { |
diff --git a/crates/ra_parser/src/grammar/paths.rs b/crates/ra_parser/src/grammar/paths.rs index fd51189d5..b503af1dc 100644 --- a/crates/ra_parser/src/grammar/paths.rs +++ b/crates/ra_parser/src/grammar/paths.rs | |||
@@ -41,10 +41,7 @@ fn path(p: &mut Parser, mode: Mode) { | |||
41 | path_segment(p, mode, true); | 41 | path_segment(p, mode, true); |
42 | let mut qual = path.complete(p, PATH); | 42 | let mut qual = path.complete(p, PATH); |
43 | loop { | 43 | loop { |
44 | let use_tree = match p.nth(2) { | 44 | let use_tree = matches!(p.nth(2), T![*] | T!['{']); |
45 | T![*] | T!['{'] => true, | ||
46 | _ => false, | ||
47 | }; | ||
48 | if p.at(T![::]) && !use_tree { | 45 | if p.at(T![::]) && !use_tree { |
49 | let path = qual.precede(p); | 46 | let path = qual.precede(p); |
50 | p.bump(T![::]); | 47 | p.bump(T![::]); |
diff --git a/crates/ra_parser/src/grammar/type_params.rs b/crates/ra_parser/src/grammar/type_params.rs index 325d566ad..d1330d4b9 100644 --- a/crates/ra_parser/src/grammar/type_params.rs +++ b/crates/ra_parser/src/grammar/type_params.rs | |||
@@ -169,10 +169,7 @@ fn is_where_predicate(p: &mut Parser) -> bool { | |||
169 | } | 169 | } |
170 | 170 | ||
171 | fn is_where_clause_end(p: &mut Parser) -> bool { | 171 | fn is_where_clause_end(p: &mut Parser) -> bool { |
172 | match p.current() { | 172 | matches!(p.current(), T!['{'] | T![;] | T![=]) |
173 | T!['{'] | T![;] | T![=] => true, | ||
174 | _ => false, | ||
175 | } | ||
176 | } | 173 | } |
177 | 174 | ||
178 | fn where_predicate(p: &mut Parser) { | 175 | fn where_predicate(p: &mut Parser) { |
diff --git a/crates/ra_parser/src/syntax_kind.rs b/crates/ra_parser/src/syntax_kind.rs index 8d6bd057b..63204436c 100644 --- a/crates/ra_parser/src/syntax_kind.rs +++ b/crates/ra_parser/src/syntax_kind.rs | |||
@@ -20,9 +20,6 @@ impl From<SyntaxKind> for u16 { | |||
20 | 20 | ||
21 | impl SyntaxKind { | 21 | impl SyntaxKind { |
22 | pub fn is_trivia(self) -> bool { | 22 | pub fn is_trivia(self) -> bool { |
23 | match self { | 23 | matches!(self, SyntaxKind::WHITESPACE | SyntaxKind::COMMENT) |
24 | SyntaxKind::WHITESPACE | SyntaxKind::COMMENT => true, | ||
25 | _ => false, | ||
26 | } | ||
27 | } | 24 | } |
28 | } | 25 | } |