diff options
author | Aleksey Kladov <[email protected]> | 2018-10-31 20:41:43 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-10-31 20:41:43 +0000 |
commit | 6be50f7d5de3737464853a589673375fc0cafa97 (patch) | |
tree | 2c6da7f3a1234c3f2fd3f330d2c9445953979598 /crates/tools/src | |
parent | 857c1650efdb51650458f9ec1119adaa49b34371 (diff) |
Reformat all
Diffstat (limited to 'crates/tools/src')
-rw-r--r-- | crates/tools/src/lib.rs | 31 | ||||
-rw-r--r-- | crates/tools/src/main.rs | 8 |
2 files changed, 19 insertions, 20 deletions
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 @@ | |||
1 | extern crate itertools; | ||
2 | extern crate failure; | 1 | extern crate failure; |
2 | extern crate itertools; | ||
3 | extern crate teraron; | 3 | extern crate teraron; |
4 | 4 | ||
5 | use std::{ | 5 | use std::{ |
@@ -7,10 +7,10 @@ use std::{ | |||
7 | process::Command, | 7 | process::Command, |
8 | }; | 8 | }; |
9 | 9 | ||
10 | use itertools::Itertools; | ||
11 | use failure::bail; | 10 | use failure::bail; |
11 | use itertools::Itertools; | ||
12 | 12 | ||
13 | pub use teraron::{Mode, Verify, Overwrite}; | 13 | pub use teraron::{Mode, Overwrite, Verify}; |
14 | 14 | ||
15 | pub type Result<T> = ::std::result::Result<T, failure::Error>; | 15 | pub type Result<T> = ::std::result::Result<T, failure::Error>; |
16 | 16 | ||
@@ -63,16 +63,8 @@ pub fn generate(mode: Mode) -> Result<()> { | |||
63 | let grammar = project_root().join(GRAMMAR); | 63 | let grammar = project_root().join(GRAMMAR); |
64 | let syntax_kinds = project_root().join(SYNTAX_KINDS); | 64 | let syntax_kinds = project_root().join(SYNTAX_KINDS); |
65 | let ast = project_root().join(AST); | 65 | let ast = project_root().join(AST); |
66 | teraron::generate( | 66 | teraron::generate(&syntax_kinds, &grammar, mode)?; |
67 | &syntax_kinds, | 67 | teraron::generate(&ast, &grammar, mode)?; |
68 | &grammar, | ||
69 | mode, | ||
70 | )?; | ||
71 | teraron::generate( | ||
72 | &ast, | ||
73 | &grammar, | ||
74 | mode, | ||
75 | )?; | ||
76 | Ok(()) | 68 | Ok(()) |
77 | } | 69 | } |
78 | 70 | ||
@@ -101,9 +93,18 @@ pub fn run(cmdline: &str, dir: &str) -> Result<()> { | |||
101 | 93 | ||
102 | pub fn run_rustfmt(mode: Mode) -> Result<()> { | 94 | pub fn run_rustfmt(mode: Mode) -> Result<()> { |
103 | run(&format!("rustup install {}", TOOLCHAIN), ".")?; | 95 | run(&format!("rustup install {}", TOOLCHAIN), ".")?; |
104 | run(&format!("rustup component add rustfmt-preview --toolchain {}", TOOLCHAIN), ".")?; | 96 | run( |
97 | &format!( | ||
98 | "rustup component add rustfmt-preview --toolchain {}", | ||
99 | TOOLCHAIN | ||
100 | ), | ||
101 | ".", | ||
102 | )?; | ||
105 | if mode == Verify { | 103 | if mode == Verify { |
106 | run(&format!("rustup run {} -- cargo fmt -- --check", TOOLCHAIN), ".")?; | 104 | run( |
105 | &format!("rustup run {} -- cargo fmt -- --check", TOOLCHAIN), | ||
106 | ".", | ||
107 | )?; | ||
107 | } else { | 108 | } else { |
108 | run(&format!("rustup run {} -- cargo fmt", TOOLCHAIN), ".")?; | 109 | run(&format!("rustup run {} -- cargo fmt", TOOLCHAIN), ".")?; |
109 | } | 110 | } |
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 @@ | |||
1 | extern crate clap; | 1 | extern crate clap; |
2 | extern crate failure; | 2 | extern crate failure; |
3 | extern crate teraron; | ||
3 | extern crate tools; | 4 | extern crate tools; |
4 | extern crate walkdir; | 5 | extern crate walkdir; |
5 | extern crate teraron; | ||
6 | 6 | ||
7 | use clap::{App, Arg, SubCommand}; | 7 | use clap::{App, Arg, SubCommand}; |
8 | use failure::bail; | ||
8 | use std::{ | 9 | use std::{ |
9 | collections::HashMap, | 10 | collections::HashMap, |
10 | fs, | 11 | fs, |
11 | path::{Path, PathBuf}, | 12 | path::{Path, PathBuf}, |
12 | }; | 13 | }; |
13 | use tools::{ | 14 | use tools::{collect_tests, generate, run, run_rustfmt, Mode, Overwrite, Result, Test, Verify}; |
14 | collect_tests, Result, Test, generate, Mode, Overwrite, Verify, run, run_rustfmt, | ||
15 | }; | ||
16 | use failure::bail; | ||
17 | 15 | ||
18 | const GRAMMAR_DIR: &str = "./crates/ra_syntax/src/grammar"; | 16 | const GRAMMAR_DIR: &str = "./crates/ra_syntax/src/grammar"; |
19 | const INLINE_TESTS_DIR: &str = "./crates/ra_syntax/tests/data/parser/inline"; | 17 | const INLINE_TESTS_DIR: &str = "./crates/ra_syntax/tests/data/parser/inline"; |