aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-01-14 12:39:42 +0000
committerAkshay <[email protected]>2022-01-14 12:39:42 +0000
commit7d732a051e695353db5a3ddbb26ab766ff736043 (patch)
treeaceda0db9a4c1d5ac64b9f061924e36ecf3f8ee9 /bin
parentd1ff222bcf94152cd657233cffd8c14a45788c26 (diff)
refactor parsing code, simplify tests
Diffstat (limited to 'bin')
-rw-r--r--bin/src/utils.rs4
-rw-r--r--bin/tests/main.rs4
2 files changed, 5 insertions, 3 deletions
diff --git a/bin/src/utils.rs b/bin/src/utils.rs
index d374b4b..a3d51b4 100644
--- a/bin/src/utils.rs
+++ b/bin/src/utils.rs
@@ -30,6 +30,8 @@ pub fn get_version_info() -> Option<String> {
30 .output() 30 .output()
31 .expect("failed to execute"); 31 .expect("failed to execute");
32 std::str::from_utf8(&program.stdout) 32 std::str::from_utf8(&program.stdout)
33 .ok() 33 .ok()?
34 .split(' ')
35 .nth(2)
34 .map(ToOwned::to_owned) 36 .map(ToOwned::to_owned)
35} 37}
diff --git a/bin/tests/main.rs b/bin/tests/main.rs
index 991c876..89d58e7 100644
--- a/bin/tests/main.rs
+++ b/bin/tests/main.rs
@@ -19,7 +19,7 @@ mod util {
19 test_lint!($($tail)*); 19 test_lint!($($tail)*);
20 }; 20 };
21 ($tname:ident) => { 21 ($tname:ident) => {
22 test_lint!($tname => session_info!("nix (Nix) 2.5")); 22 test_lint!($tname => session_info!("2.5"));
23 }; 23 };
24 ($tname:ident => $sess:expr) => { 24 ($tname:ident => $sess:expr) => {
25 #[test] 25 #[test]
@@ -61,5 +61,5 @@ test_lint! {
61 unquoted_uri, 61 unquoted_uri,
62 deprecated_is_null, 62 deprecated_is_null,
63 empty_inherit, 63 empty_inherit,
64 faster_groupby => session_info!("nix (Nix) 2.5") 64 faster_groupby => session_info!("2.5")
65} 65}