1
1
#![ cfg( not( windows) ) ] // TODO: should fix these tests on Windows
2
2
3
- use duct;
4
- use env_logger;
5
- #[ macro_use]
6
- extern crate log;
7
- use rustfix;
8
-
9
- #[ macro_use]
10
- extern crate failure;
11
-
12
3
use std:: collections:: HashSet ;
13
4
use std:: env;
14
5
use std:: ffi:: OsString ;
15
6
use std:: fs;
16
7
use std:: path:: { Path , PathBuf } ;
17
8
use std:: process:: Output ;
18
-
19
- use failure:: { Error , ResultExt } ;
9
+ use anyhow:: { Error , Context , ensure, anyhow} ;
20
10
use tempdir:: TempDir ;
21
-
22
11
use rustfix:: apply_suggestions;
12
+ use log:: { info, warn, debug} ;
23
13
24
14
mod fixmode {
25
15
pub const EVERYTHING : & str = "yolo" ;
@@ -67,7 +57,7 @@ fn compile_and_get_json_errors(file: &Path, mode: &str) -> Result<String, Error>
67
57
68
58
match res. status . code ( ) {
69
59
Some ( 0 ) | Some ( 1 ) | Some ( 101 ) => Ok ( stderr) ,
70
- _ => Err ( format_err ! (
60
+ _ => Err ( anyhow ! (
71
61
"failed with status {:?}: {}" ,
72
62
res. status. code( ) ,
73
63
stderr
@@ -86,7 +76,7 @@ fn compiles_without_errors(file: &Path, mode: &str) -> Result<(), Error> {
86
76
file,
87
77
String :: from_utf8( res. stderr) ?
88
78
) ;
89
- Err ( format_err ! (
79
+ Err ( anyhow ! (
90
80
"failed with status {:?} (`env RUST_LOG=parse_and_replace=info` for more info)" ,
91
81
res. status. code( ) ,
92
82
) )
@@ -226,10 +216,7 @@ fn assert_fixtures(dir: &str, mode: &str) {
226
216
for file in & files {
227
217
if let Err ( err) = test_rustfix_with_file ( file, mode) {
228
218
println ! ( "failed: {}" , file. display( ) ) ;
229
- warn ! ( "{}" , err) ;
230
- for cause in err. iter_chain ( ) . skip ( 1 ) {
231
- info ! ( "\t caused by: {}" , cause) ;
232
- }
219
+ warn ! ( "{:?}" , err) ;
233
220
failures += 1 ;
234
221
}
235
222
info ! ( "passed: {:?}" , file) ;
0 commit comments