From 9ce7e8110254e8db476c96bce2eecb2d16983159 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Jul 2018 15:40:40 +0300 Subject: cleanups --- src/parser/grammar/expressions.rs | 2 +- src/parser/grammar/items/mod.rs | 1 - src/parser/grammar/items/traits.rs | 1 - src/parser/grammar/mod.rs | 7 +++++-- src/parser/grammar/paths.rs | 8 ++++++-- src/parser/grammar/patterns.rs | 7 ++----- src/parser/grammar/type_args.rs | 2 +- 7 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/parser') diff --git a/src/parser/grammar/expressions.rs b/src/parser/grammar/expressions.rs index a6456c8d5..11bb3436b 100644 --- a/src/parser/grammar/expressions.rs +++ b/src/parser/grammar/expressions.rs @@ -39,7 +39,7 @@ pub(super) fn expr(p: &mut Parser) { fn prefix_expr(p: &mut Parser) -> Option { match p.current() { AMPERSAND => Some(ref_expr(p)), - _ => atom_expr(p) + _ => atom_expr(p), } } diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index 0d9eccd2f..9147df87d 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs @@ -218,7 +218,6 @@ fn extern_block(p: &mut Parser) { p.expect(R_CURLY); } - fn fn_item(p: &mut Parser) { assert!(p.at(FN_KW)); p.bump(); diff --git a/src/parser/grammar/items/traits.rs b/src/parser/grammar/items/traits.rs index c7450b761..812cacfb7 100644 --- a/src/parser/grammar/items/traits.rs +++ b/src/parser/grammar/items/traits.rs @@ -8,7 +8,6 @@ pub(super) fn trait_item(p: &mut Parser) { p.expect(R_CURLY); } - // test impl_item // impl Foo {} pub(super) fn impl_item(p: &mut Parser) { diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs index c2da775a2..498b45d44 100644 --- a/src/parser/grammar/mod.rs +++ b/src/parser/grammar/mod.rs @@ -26,12 +26,15 @@ mod expressions; mod items; mod paths; mod patterns; -mod type_params; mod type_args; +mod type_params; mod types; use { - parser::{parser::{Parser, CompletedMarker}, token_set::TokenSet}, + parser::{ + parser::{CompletedMarker, Parser}, + token_set::TokenSet, + }, SyntaxKind::{self, *}, }; diff --git a/src/parser/grammar/paths.rs b/src/parser/grammar/paths.rs index 69ed84665..6f66701ac 100644 --- a/src/parser/grammar/paths.rs +++ b/src/parser/grammar/paths.rs @@ -20,7 +20,11 @@ pub(super) fn expr_path(p: &mut Parser) { } #[derive(Clone, Copy, Eq, PartialEq)] -enum Mode { Use, Type, Expr } +enum Mode { + Use, + Type, + Expr, +} fn path(p: &mut Parser, mode: Mode) { if !is_path_start(p) { @@ -55,7 +59,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) { IDENT => { name_ref(p); path_generic_args(p, mode); - }, + } SELF_KW | SUPER_KW => p.bump(), _ => { p.error("expected identifier"); diff --git a/src/parser/grammar/patterns.rs b/src/parser/grammar/patterns.rs index a5d13a124..7216807fd 100644 --- a/src/parser/grammar/patterns.rs +++ b/src/parser/grammar/patterns.rs @@ -43,11 +43,8 @@ fn ref_pat(p: &mut Parser) { // } fn bind_pat(p: &mut Parser) { let m = p.start(); - if p.eat(REF_KW) { - p.eat(MUT_KW); - } else { - p.eat(MUT_KW); - } + p.eat(REF_KW); + p.eat(MUT_KW); name(p); if p.eat(AT) { pattern(p); diff --git a/src/parser/grammar/type_args.rs b/src/parser/grammar/type_args.rs index 20e75b4b0..adac73e7e 100644 --- a/src/parser/grammar/type_args.rs +++ b/src/parser/grammar/type_args.rs @@ -12,7 +12,7 @@ pub(super) fn list(p: &mut Parser, colon_colon_required: bool) { m = p.start(); p.bump(); } - _ => return + _ => return, }; while !p.at(EOF) && !p.at(R_ANGLE) { -- cgit v1.2.3