From 6be50f7d5de3737464853a589673375fc0cafa97 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 31 Oct 2018 23:41:43 +0300 Subject: Reformat all --- crates/tools/src/lib.rs | 31 ++++++++++++++++--------------- crates/tools/src/main.rs | 8 +++----- crates/tools/tests/cli.rs | 9 +++++---- 3 files changed, 24 insertions(+), 24 deletions(-) (limited to 'crates/tools') diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index 29c46c7c4..3387d0620 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -1,5 +1,5 @@ -extern crate itertools; extern crate failure; +extern crate itertools; extern crate teraron; use std::{ @@ -7,10 +7,10 @@ use std::{ process::Command, }; -use itertools::Itertools; use failure::bail; +use itertools::Itertools; -pub use teraron::{Mode, Verify, Overwrite}; +pub use teraron::{Mode, Overwrite, Verify}; pub type Result = ::std::result::Result; @@ -63,16 +63,8 @@ pub fn generate(mode: Mode) -> Result<()> { let grammar = project_root().join(GRAMMAR); let syntax_kinds = project_root().join(SYNTAX_KINDS); let ast = project_root().join(AST); - teraron::generate( - &syntax_kinds, - &grammar, - mode, - )?; - teraron::generate( - &ast, - &grammar, - mode, - )?; + teraron::generate(&syntax_kinds, &grammar, mode)?; + teraron::generate(&ast, &grammar, mode)?; Ok(()) } @@ -101,9 +93,18 @@ pub fn run(cmdline: &str, dir: &str) -> Result<()> { pub fn run_rustfmt(mode: Mode) -> Result<()> { run(&format!("rustup install {}", TOOLCHAIN), ".")?; - run(&format!("rustup component add rustfmt-preview --toolchain {}", TOOLCHAIN), ".")?; + run( + &format!( + "rustup component add rustfmt-preview --toolchain {}", + TOOLCHAIN + ), + ".", + )?; if mode == Verify { - run(&format!("rustup run {} -- cargo fmt -- --check", TOOLCHAIN), ".")?; + run( + &format!("rustup run {} -- cargo fmt -- --check", TOOLCHAIN), + ".", + )?; } else { run(&format!("rustup run {} -- cargo fmt", TOOLCHAIN), ".")?; } diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs index 91675bbf0..dc623a464 100644 --- a/crates/tools/src/main.rs +++ b/crates/tools/src/main.rs @@ -1,19 +1,17 @@ extern crate clap; extern crate failure; +extern crate teraron; extern crate tools; extern crate walkdir; -extern crate teraron; use clap::{App, Arg, SubCommand}; +use failure::bail; use std::{ collections::HashMap, fs, path::{Path, PathBuf}, }; -use tools::{ - collect_tests, Result, Test, generate, Mode, Overwrite, Verify, run, run_rustfmt, -}; -use failure::bail; +use tools::{collect_tests, generate, run, run_rustfmt, Mode, Overwrite, Result, Test, Verify}; const GRAMMAR_DIR: &str = "./crates/ra_syntax/src/grammar"; const INLINE_TESTS_DIR: &str = "./crates/ra_syntax/tests/data/parser/inline"; diff --git a/crates/tools/tests/cli.rs b/crates/tools/tests/cli.rs index 8c53a8230..2d238d9ea 100644 --- a/crates/tools/tests/cli.rs +++ b/crates/tools/tests/cli.rs @@ -1,8 +1,6 @@ extern crate tools; -use tools::{ - generate, Verify, run_rustfmt, -}; +use tools::{generate, run_rustfmt, Verify}; #[test] fn verify_template_generation() { @@ -14,6 +12,9 @@ fn verify_template_generation() { #[test] fn check_code_formatting() { if let Err(error) = run_rustfmt(Verify) { - panic!("{}. Please format the code by running `cargo format`", error); + panic!( + "{}. Please format the code by running `cargo format`", + error + ); } } -- cgit v1.2.3