From f356628ad8392c6e3ffd72a9ac50a7be87d3d183 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 11 Feb 2018 17:58:33 +0300 Subject: [PATCH] Formatting --- src/parser/event.rs | 4 +--- src/parser/grammar/items/mod.rs | 4 ++-- src/parser/parser/imp.rs | 12 +++++------- src/parser/parser/mod.rs | 1 - src/parser/token_set.rs | 1 - 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/parser/event.rs b/src/parser/event.rs index 4af16d783b..1c0905a38f 100644 --- a/src/parser/event.rs +++ b/src/parser/event.rs @@ -140,9 +140,7 @@ pub(super) fn to_file(text: String, tokens: &[Token], events: Vec) -> Fil } builder.leaf(kind, len); } - &Event::Error { ref msg } => builder.error(ErrorMsg { - msg: msg.clone(), - }), + &Event::Error { ref msg } => builder.error(ErrorMsg { msg: msg.clone() }), } } builder.finish() diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index 18ee8af863..3af6d13a19 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs @@ -94,7 +94,7 @@ fn item(p: &mut Parser) { // test unsafe_auto_trait // unsafe auto trait T {} - IDENT if p.at_kw("auto") && la == TRAIT_KW => { + IDENT if p.at_contextual_kw("auto") && la == TRAIT_KW => { p.bump_remap(AUTO_KW); traits::trait_item(p); TRAIT_ITEM @@ -109,7 +109,7 @@ fn item(p: &mut Parser) { // test unsafe_default_impl // unsafe default impl Foo {} - IDENT if p.at_kw("default") && la == IMPL_KW => { + IDENT if p.at_contextual_kw("default") && la == IMPL_KW => { p.bump_remap(DEFAULT_KW); traits::impl_item(p); IMPL_ITEM diff --git a/src/parser/parser/imp.rs b/src/parser/parser/imp.rs index 03c0440913..f2641c3886 100644 --- a/src/parser/parser/imp.rs +++ b/src/parser/parser/imp.rs @@ -1,8 +1,8 @@ -use parser::input::{ParserInput, InputPosition}; +use parser::input::{InputPosition, ParserInput}; use parser::event::Event; use SyntaxKind; -use syntax_kinds::{TOMBSTONE, EOF}; +use syntax_kinds::{EOF, TOMBSTONE}; /// Implementation details of `Parser`, extracted /// to a separate struct in order not to pollute @@ -29,7 +29,6 @@ impl<'t> ParserImpl<'t> { self.events } - pub(super) fn nth(&self, n: u32) -> SyntaxKind { self.inp.kind(self.pos + n) } @@ -92,9 +91,9 @@ impl<'t> ParserImpl<'t> { if idx == self.events.len() - 1 { match self.events.pop() { Some(Event::Start { - kind: TOMBSTONE, - forward_parent: None, - }) => (), + kind: TOMBSTONE, + forward_parent: None, + }) => (), _ => unreachable!(), } } @@ -114,7 +113,6 @@ impl<'t> ParserImpl<'t> { new_pos } - fn event(&mut self, event: Event) { self.events.push(event) } diff --git a/src/parser/parser/mod.rs b/src/parser/parser/mod.rs index 618b439be5..58f8207381 100644 --- a/src/parser/parser/mod.rs +++ b/src/parser/parser/mod.rs @@ -126,7 +126,6 @@ impl Drop for Marker { } } - pub(crate) struct CompletedMarker(u32); impl CompletedMarker { diff --git a/src/parser/token_set.rs b/src/parser/token_set.rs index 82558fa2e7..a800f200db 100644 --- a/src/parser/token_set.rs +++ b/src/parser/token_set.rs @@ -22,4 +22,3 @@ macro_rules! token_set { token_set!($($t),*) }; } -