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/config.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'bin/src/config.rs') diff --git a/bin/src/config.rs b/bin/src/config.rs index cbb1f66..ef3a29d 100644 --- a/bin/src/config.rs +++ b/bin/src/config.rs @@ -190,9 +190,12 @@ fn walk_with_ignores>( fn vfs(files: Vec) -> Result { let mut vfs = ReadOnlyVfs::default(); for file in files.iter() { - let _id = vfs.alloc_file_id(&file); - let data = fs::read_to_string(&file).map_err(ConfigErr::InvalidPath)?; - vfs.set_file_contents(&file, data.as_bytes()); + if let Ok(data) = fs::read_to_string(&file) { + let _id = vfs.alloc_file_id(&file); + vfs.set_file_contents(&file, data.as_bytes()); + } else { + println!("{} contains non-utf8 content", file.display()); + }; } Ok(vfs) } -- cgit v1.2.3