diff --git a/cli/src/main.rs b/cli/src/main.rs index 707fbd94c3d..f6e7e2fedf1 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -5,9 +5,9 @@ extern crate libsyntax2; extern crate tools; use clap::{App, Arg, SubCommand}; +use std::time::Instant; use std::{fs, io::Read, path::Path}; use tools::collect_tests; -use std::time::Instant; type Result = ::std::result::Result; diff --git a/src/parser/grammar/expressions.rs b/src/parser/grammar/expressions.rs index 881d947acc0..ef3a0f76c42 100644 --- a/src/parser/grammar/expressions.rs +++ b/src/parser/grammar/expressions.rs @@ -34,12 +34,11 @@ pub(super) fn expr(p: &mut Parser) { loop { lhs = match p.current() { L_PAREN => call_expr(p, lhs), - DOT if p.nth(1) == IDENT => - if p.nth(2) == L_PAREN { - method_call_expr(p, lhs) - } else { - field_expr(p, lhs) - } + DOT if p.nth(1) == IDENT => if p.nth(2) == L_PAREN { + method_call_expr(p, lhs) + } else { + field_expr(p, lhs) + }, _ => break, } } @@ -193,11 +192,11 @@ fn struct_lit(p: &mut Parser) { expr(p); } m.complete(p, STRUCT_LIT_FIELD); - }, + } DOTDOT => { p.bump(); expr(p); - }, + } _ => p.err_and_bump("expected identifier"), } if !p.at(R_CURLY) { diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs index 53ef281817b..69942e7f1c1 100644 --- a/src/parser/grammar/mod.rs +++ b/src/parser/grammar/mod.rs @@ -142,7 +142,9 @@ fn fn_value_parameters(p: &mut Parser) { _ => return, }; let m = p.start(); - for _ in 0..n_toks { p.bump(); } + for _ in 0..n_toks { + p.bump(); + } m.complete(p, SELF_PARAM); if !p.at(R_PAREN) { p.expect(COMMA); diff --git a/src/parser/grammar/type_args.rs b/src/parser/grammar/type_args.rs index 276c8b4ae42..94d76b25af8 100644 --- a/src/parser/grammar/type_args.rs +++ b/src/parser/grammar/type_args.rs @@ -33,16 +33,16 @@ fn type_arg(p: &mut Parser) { LIFETIME => { p.bump(); m.complete(p, LIFETIME_ARG); - }, + } IDENT if p.nth(1) == EQ => { name_ref(p); p.bump(); types::type_(p); m.complete(p, ASSOC_TYPE_ARG); - }, + } _ => { types::type_(p); m.complete(p, TYPE_ARG); - }, + } } } diff --git a/src/utils.rs b/src/utils.rs index 327d89a2453..a23a5742369 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,7 +1,7 @@ -use std::{fmt::Write}; +use std::fmt::Write; use { + algo::walk::{walk, WalkEvent}, SyntaxNode, - algo::walk::{WalkEvent, walk}, }; /// Parse a file and create a string representation of the resulting parse tree. @@ -34,13 +34,13 @@ pub fn dump_tree(syntax: &SyntaxNode) -> String { } } level += 1; - }, + } WalkEvent::Exit(_) => level -= 1, } } assert_eq!(level, 0); - for err in errors[err_pos..].iter() { + for err in errors[err_pos..].iter() { writeln!(buf, "err: `{}`", err.message).unwrap(); }