aboutsummaryrefslogtreecommitdiff
path: root/bin/src/config.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-29 13:50:54 +0100
committerAkshay <[email protected]>2021-10-29 14:14:14 +0100
commit1a97cce01f8e49b33bf28cbcdfeb3c8aefd809a5 (patch)
tree62613f193d84ea8b0c0aa94d09758fee19a6042d /bin/src/config.rs
parentd510714ed5a1eae0f6e5e435e4cff4875b06751d (diff)
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
Diffstat (limited to 'bin/src/config.rs')
-rw-r--r--bin/src/config.rs9
1 files changed, 6 insertions, 3 deletions
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<P: AsRef<Path>>(
190fn vfs(files: Vec<PathBuf>) -> Result<ReadOnlyVfs, ConfigErr> { 190fn vfs(files: Vec<PathBuf>) -> Result<ReadOnlyVfs, ConfigErr> {
191 let mut vfs = ReadOnlyVfs::default(); 191 let mut vfs = ReadOnlyVfs::default();
192 for file in files.iter() { 192 for file in files.iter() {
193 let _id = vfs.alloc_file_id(&file); 193 if let Ok(data) = fs::read_to_string(&file) {
194 let data = fs::read_to_string(&file).map_err(ConfigErr::InvalidPath)?; 194 let _id = vfs.alloc_file_id(&file);
195 vfs.set_file_contents(&file, data.as_bytes()); 195 vfs.set_file_contents(&file, data.as_bytes());
196 } else {
197 println!("{} contains non-utf8 content", file.display());
198 };
196 } 199 }
197 Ok(vfs) 200 Ok(vfs)
198} 201}