From 1a97cce01f8e49b33bf28cbcdfeb3c8aefd809a5 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 29 Oct 2021 18:20:54 +0530 Subject: report syntax errors as statix errors - statix now reports errors also, not just warnings - all diagnostics are available on stderr stream - non-utf8 files are skipped, does not eject early --- bin/src/main.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'bin/src/main.rs') diff --git a/bin/src/main.rs b/bin/src/main.rs index c5d0626..90b79ce 100644 --- a/bin/src/main.rs +++ b/bin/src/main.rs @@ -20,17 +20,9 @@ fn _main() -> Result<(), StatixErr> { match opts.cmd { SubCommand::Check(check_config) => { let vfs = check_config.vfs()?; - let (lints, errors): (Vec<_>, Vec<_>) = - vfs.iter().map(lint::lint).partition(Result::is_ok); - let lint_results = lints.into_iter().map(Result::unwrap); - let errors = errors.into_iter().map(Result::unwrap_err); - - let mut stdout = io::stdout(); - lint_results.for_each(|r| { - stdout.write(&r, &vfs, check_config.format).unwrap(); - }); - errors.for_each(|e| { - eprintln!("{}", e); + let mut stderr = io::stderr(); + vfs.iter().map(lint::lint).for_each(|r| { + stderr.write(&r, &vfs, check_config.format).unwrap(); }); } SubCommand::Fix(fix_config) => { -- cgit v1.2.3