aboutsummaryrefslogtreecommitdiff
path: root/bin/src/fix.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-01-14 16:51:42 +0000
committerAkshay <[email protected]>2022-01-14 16:51:42 +0000
commit305960c98b3b71d4b915003430730c76fcda3af3 (patch)
tree09a428186f1aaacca8c4447f2feb7e08aa204217 /bin/src/fix.rs
parent7d732a051e695353db5a3ddbb26ab766ff736043 (diff)
add dump command, support version overrides in statix.tomlsession-info
Diffstat (limited to 'bin/src/fix.rs')
-rw-r--r--bin/src/fix.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/bin/src/fix.rs b/bin/src/fix.rs
index 4b2ce0c..84186d4 100644
--- a/bin/src/fix.rs
+++ b/bin/src/fix.rs
@@ -41,22 +41,22 @@ pub mod main {
41 use std::borrow::Cow; 41 use std::borrow::Cow;
42 42
43 use crate::{ 43 use crate::{
44 config::{Fix as FixConfig, FixOut, Single as SingleConfig}, 44 config::{
45 FixOut, Single as SingleConfig, {ConfFile, Fix as FixConfig},
46 },
45 err::{FixErr, StatixErr}, 47 err::{FixErr, StatixErr},
46 utils,
47 }; 48 };
48 49
49 use lib::session::{SessionInfo, Version}; 50 use lib::session::SessionInfo;
50 use similar::TextDiff; 51 use similar::TextDiff;
51 52
52 pub fn all(fix_config: FixConfig) -> Result<(), StatixErr> { 53 pub fn all(fix_config: FixConfig) -> Result<(), StatixErr> {
53 let vfs = fix_config.vfs()?; 54 let vfs = fix_config.vfs()?;
54 let lints = fix_config.lints()?; 55 let conf_file = ConfFile::discover(&fix_config.conf_path)?;
56
57 let lints = conf_file.lints();
58 let version = conf_file.version()?;
55 59
56 let version = utils::get_version_info()
57 .unwrap()
58 .parse::<Version>()
59 .unwrap();
60 let session = SessionInfo::from_version(version); 60 let session = SessionInfo::from_version(version);
61 61
62 for entry in vfs.iter() { 62 for entry in vfs.iter() {
@@ -102,10 +102,10 @@ pub mod main {
102 let original_src = entry.contents; 102 let original_src = entry.contents;
103 let (line, col) = single_config.position; 103 let (line, col) = single_config.position;
104 104
105 let version = utils::get_version_info() 105 let conf_file = ConfFile::discover(&single_config.conf_path)?;
106 .unwrap() 106
107 .parse::<Version>() 107 let version = conf_file.version()?;
108 .unwrap(); 108
109 let session = SessionInfo::from_version(version); 109 let session = SessionInfo::from_version(version);
110 110
111 match ( 111 match (