From ac932df22a993f0b287e60aa42055405ef94a6ae Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 9 Feb 2018 22:55:50 +0300 Subject: reformat --- src/lib.rs | 2 +- src/parser/event.rs | 6 +++--- src/parser/grammar/paths.rs | 2 +- src/parser/parser.rs | 11 ++++------- src/tree/file_builder.rs | 2 +- src/tree/mod.rs | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f4a313b7a..153458644 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,7 @@ mod parser; pub mod syntax_kinds; pub use text::{TextRange, TextUnit}; pub use tree::{File, Node, SyntaxKind, Token}; -pub(crate) use tree::{FileBuilder, Sink, ErrorMsg}; +pub(crate) use tree::{ErrorMsg, FileBuilder, Sink}; pub use lexer::{next_token, tokenize}; pub use parser::parse; diff --git a/src/parser/event.rs b/src/parser/event.rs index 546dbcf62..90348398e 100644 --- a/src/parser/event.rs +++ b/src/parser/event.rs @@ -1,4 +1,4 @@ -use {File, FileBuilder, ErrorMsg, Sink, SyntaxKind, TextUnit, Token}; +use {ErrorMsg, File, FileBuilder, Sink, SyntaxKind, TextUnit, Token}; use syntax_kinds::TOMBSTONE; use super::is_insignificant; @@ -141,8 +141,8 @@ pub(super) fn to_file(text: String, tokens: &[Token], events: Vec) -> Fil builder.leaf(kind, len); } &Event::Error { ref message } => builder.error(ErrorMsg { - message: message.clone() - }) + message: message.clone(), + }), } } builder.finish() diff --git a/src/parser/grammar/paths.rs b/src/parser/grammar/paths.rs index 1aa30f28b..a7fc90774 100644 --- a/src/parser/grammar/paths.rs +++ b/src/parser/grammar/paths.rs @@ -45,7 +45,7 @@ fn path_segment(p: &mut Parser, first: bool) { IDENT | SELF_KW | SUPER_KW => p.bump(), _ => { p.error("expected identifier"); - }, + } }; segment.complete(p, PATH_SEGMENT); } diff --git a/src/parser/parser.rs b/src/parser/parser.rs index 069701483..7c8e47cb6 100644 --- a/src/parser/parser.rs +++ b/src/parser/parser.rs @@ -27,9 +27,9 @@ impl Marker { if idx == p.events.len() - 1 { match p.events.pop() { Some(Event::Start { - kind: TOMBSTONE, - forward_parent: None, - }) => (), + kind: TOMBSTONE, + forward_parent: None, + }) => (), _ => unreachable!(), } } @@ -188,9 +188,6 @@ impl<'p, 't: 'p> Drop for ErrorBuilder<'p, 't> { impl<'t, 'p> ErrorBuilder<'p, 't> { fn new(parser: &'p mut Parser<'t>, message: String) -> Self { - ErrorBuilder { - message, - parser, - } + ErrorBuilder { message, parser } } } diff --git a/src/tree/file_builder.rs b/src/tree/file_builder.rs index 81702b83e..3c7e2d7cf 100644 --- a/src/tree/file_builder.rs +++ b/src/tree/file_builder.rs @@ -157,5 +157,5 @@ fn grow(left: &mut TextRange, right: TextRange) { #[derive(Default)] pub(crate) struct ErrorMsg { - pub(crate) message: String + pub(crate) message: String, } diff --git a/src/tree/mod.rs b/src/tree/mod.rs index b7ed59793..ebf26777b 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs @@ -4,7 +4,7 @@ use std::fmt; use std::cmp; mod file_builder; -pub(crate) use self::file_builder::{FileBuilder, Sink, ErrorMsg}; +pub(crate) use self::file_builder::{ErrorMsg, FileBuilder, Sink}; pub use syntax_kinds::SyntaxKind; -- cgit v1.2.3