diff options
Diffstat (limited to 'crates/ra_tools/src/lib.rs')
-rw-r--r-- | crates/ra_tools/src/lib.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_tools/src/lib.rs b/crates/ra_tools/src/lib.rs index 61f6b08cd..821209567 100644 --- a/crates/ra_tools/src/lib.rs +++ b/crates/ra_tools/src/lib.rs | |||
@@ -3,15 +3,15 @@ use std::{ | |||
3 | collections::HashMap, | 3 | collections::HashMap, |
4 | path::{Path, PathBuf}, | 4 | path::{Path, PathBuf}, |
5 | process::{Command, Output, Stdio}, | 5 | process::{Command, Output, Stdio}, |
6 | io::{Error, ErrorKind} | 6 | io::{Error as IoError, ErrorKind}, |
7 | error::Error | ||
7 | }; | 8 | }; |
8 | 9 | ||
9 | use failure::bail; | ||
10 | use itertools::Itertools; | 10 | use itertools::Itertools; |
11 | 11 | ||
12 | pub use teraron::{Mode, Overwrite, Verify}; | 12 | pub use teraron::{Mode, Overwrite, Verify}; |
13 | 13 | ||
14 | pub type Result<T> = std::result::Result<T, failure::Error>; | 14 | pub type Result<T> = std::result::Result<T, Box<dyn Error>>; |
15 | 15 | ||
16 | pub const GRAMMAR: &str = "crates/ra_syntax/src/grammar.ron"; | 16 | pub const GRAMMAR: &str = "crates/ra_syntax/src/grammar.ron"; |
17 | const GRAMMAR_DIR: &str = "crates/ra_parser/src/grammar"; | 17 | const GRAMMAR_DIR: &str = "crates/ra_parser/src/grammar"; |
@@ -128,7 +128,7 @@ pub fn install_format_hook() -> Result<()> { | |||
128 | fs::copy("./target/debug/pre-commit", result_path)?; | 128 | fs::copy("./target/debug/pre-commit", result_path)?; |
129 | } | 129 | } |
130 | } else { | 130 | } else { |
131 | return Err(Error::new(ErrorKind::AlreadyExists, "Git hook already created").into()); | 131 | Err(IoError::new(ErrorKind::AlreadyExists, "Git hook already created"))?; |
132 | } | 132 | } |
133 | Ok(()) | 133 | Ok(()) |
134 | } | 134 | } |
@@ -224,7 +224,7 @@ where | |||
224 | f(cmd.args(args).current_dir(proj_dir).stderr(Stdio::inherit())); | 224 | f(cmd.args(args).current_dir(proj_dir).stderr(Stdio::inherit())); |
225 | let output = cmd.output()?; | 225 | let output = cmd.output()?; |
226 | if !output.status.success() { | 226 | if !output.status.success() { |
227 | bail!("`{}` exited with {}", cmdline, output.status); | 227 | Err(format!("`{}` exited with {}", cmdline, output.status))?; |
228 | } | 228 | } |
229 | Ok(output) | 229 | Ok(output) |
230 | } | 230 | } |
@@ -256,11 +256,11 @@ fn tests_from_dir(dir: &Path) -> Result<Tests> { | |||
256 | for (_, test) in collect_tests(&text) { | 256 | for (_, test) in collect_tests(&text) { |
257 | if test.ok { | 257 | if test.ok { |
258 | if let Some(old_test) = res.ok.insert(test.name.clone(), test) { | 258 | if let Some(old_test) = res.ok.insert(test.name.clone(), test) { |
259 | bail!("Duplicate test: {}", old_test.name) | 259 | Err(format!("Duplicate test: {}", old_test.name))? |
260 | } | 260 | } |
261 | } else { | 261 | } else { |
262 | if let Some(old_test) = res.err.insert(test.name.clone(), test) { | 262 | if let Some(old_test) = res.err.insert(test.name.clone(), test) { |
263 | bail!("Duplicate test: {}", old_test.name) | 263 | Err(format!("Duplicate test: {}", old_test.name))? |
264 | } | 264 | } |
265 | } | 265 | } |
266 | } | 266 | } |