aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-01-29 11:01:20 +0000
committerAkshay <[email protected]>2022-01-29 11:01:20 +0000
commitdf29effd59bb8971395419b79e8c0e51f373d4fb (patch)
tree1d1fd9c1fdbb68260a7de24c2a799541f3ad1e24
parent8e4eeb979ebaa8f0f461e66d986a75c3a80220b6 (diff)
bump rnix to latest master, support nix 2.5 syntax
-rw-r--r--Cargo.lock5
-rw-r--r--bin/Cargo.toml5
-rw-r--r--lib/Cargo.toml5
-rw-r--r--lib/src/lints/bool_comparison.rs5
-rw-r--r--lib/src/lints/empty_pattern.rs1
5 files changed, 14 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index a542e65..5b347d2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -398,9 +398,8 @@ checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
398 398
399[[package]] 399[[package]]
400name = "rnix" 400name = "rnix"
401version = "0.9.1" 401version = "0.10.1"
402source = "registry+https://github.com/rust-lang/crates.io-index" 402source = "git+https://github.com/nix-community/rnix-parser?rev=8083f5694ddeaca47c946aa9ae7ecf117fa4823b#8083f5694ddeaca47c946aa9ae7ecf117fa4823b"
403checksum = "294becb48f58c496d96c10a12df290266204ca75c9799be4d04222bfaebb6a37"
404dependencies = [ 403dependencies = [
405 "cbitset", 404 "cbitset",
406 "rowan", 405 "rowan",
diff --git a/bin/Cargo.toml b/bin/Cargo.toml
index 4e83ee3..34d6513 100644
--- a/bin/Cargo.toml
+++ b/bin/Cargo.toml
@@ -16,7 +16,6 @@ path = "src/main.rs"
16 16
17[dependencies] 17[dependencies]
18ariadne = "0.1.3" 18ariadne = "0.1.3"
19rnix = "0.9.0"
20clap = "3.0.0-beta.4" 19clap = "3.0.0-beta.4"
21ignore = "0.4.18" 20ignore = "0.4.18"
22thiserror = "1.0.30" 21thiserror = "1.0.30"
@@ -25,6 +24,10 @@ vfs = { path = "../vfs" }
25lib = { path = "../lib" } 24lib = { path = "../lib" }
26toml = "0.5.8" 25toml = "0.5.8"
27 26
27[dependencies.rnix]
28git = "https://github.com/nix-community/rnix-parser"
29rev = "8083f5694ddeaca47c946aa9ae7ecf117fa4823b"
30
28[dependencies.serde] 31[dependencies.serde]
29version = "1.0.68" 32version = "1.0.68"
30features = [ "derive" ] 33features = [ "derive" ]
diff --git a/lib/Cargo.toml b/lib/Cargo.toml
index 54b9c52..d90c5bf 100644
--- a/lib/Cargo.toml
+++ b/lib/Cargo.toml
@@ -7,13 +7,16 @@ license = "MIT"
7# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8 8
9[dependencies] 9[dependencies]
10rnix = "0.9.0"
11if_chain = "1.0" 10if_chain = "1.0"
12macros = { path = "../macros" } 11macros = { path = "../macros" }
13lazy_static = "1.0" 12lazy_static = "1.0"
14rowan = "0.12.5" 13rowan = "0.12.5"
15serde_json = { version = "1.0.68", optional = true } 14serde_json = { version = "1.0.68", optional = true }
16 15
16[dependencies.rnix]
17git = "https://github.com/nix-community/rnix-parser"
18rev = "8083f5694ddeaca47c946aa9ae7ecf117fa4823b"
19
17[dependencies.serde] 20[dependencies.serde]
18version = "1.0.130" 21version = "1.0.130"
19features = [ "derive" ] 22features = [ "derive" ]
diff --git a/lib/src/lints/bool_comparison.rs b/lib/src/lints/bool_comparison.rs
index ef7f5d2..5402f31 100644
--- a/lib/src/lints/bool_comparison.rs
+++ b/lib/src/lints/bool_comparison.rs
@@ -41,8 +41,9 @@ impl Rule for BoolComparison {
41 if let Some(bin_expr) = BinOp::cast(node.clone()); 41 if let Some(bin_expr) = BinOp::cast(node.clone());
42 if let Some(lhs) = bin_expr.lhs(); 42 if let Some(lhs) = bin_expr.lhs();
43 if let Some(rhs) = bin_expr.rhs(); 43 if let Some(rhs) = bin_expr.rhs();
44 if let Some(op) = bin_expr.operator();
44 45
45 if let op@(BinOpKind::Equal | BinOpKind::NotEqual) = bin_expr.operator(); 46 if let BinOpKind::Equal | BinOpKind::NotEqual = op;
46 let (non_bool_side, bool_side) = if boolean_ident(&lhs).is_some() { 47 let (non_bool_side, bool_side) = if boolean_ident(&lhs).is_some() {
47 (rhs, lhs) 48 (rhs, lhs)
48 } else if boolean_ident(&rhs).is_some() { 49 } else if boolean_ident(&rhs).is_some() {
@@ -70,7 +71,7 @@ impl Rule for BoolComparison {
70 SyntaxKind::NODE_BIN_OP => { 71 SyntaxKind::NODE_BIN_OP => {
71 let inner = BinOp::cast(non_bool_side.clone()).unwrap(); 72 let inner = BinOp::cast(non_bool_side.clone()).unwrap();
72 // `!a ? b`, no paren required 73 // `!a ? b`, no paren required
73 if inner.operator() == BinOpKind::IsSet { 74 if inner.operator()? == BinOpKind::IsSet {
74 make::unary_not(&non_bool_side).node().clone() 75 make::unary_not(&non_bool_side).node().clone()
75 } else { 76 } else {
76 let parens = make::parenthesize(&non_bool_side); 77 let parens = make::parenthesize(&non_bool_side);
diff --git a/lib/src/lints/empty_pattern.rs b/lib/src/lints/empty_pattern.rs
index b399ba2..14c3b5e 100644
--- a/lib/src/lints/empty_pattern.rs
+++ b/lib/src/lints/empty_pattern.rs
@@ -49,6 +49,7 @@ impl Rule for EmptyPattern {
49 if let Some(body) = lambda_expr.body(); 49 if let Some(body) = lambda_expr.body();
50 50
51 if let Some(pattern) = Pattern::cast(arg.clone()); 51 if let Some(pattern) = Pattern::cast(arg.clone());
52
52 // no patterns within `{ }` 53 // no patterns within `{ }`
53 if pattern.entries().count() == 0; 54 if pattern.entries().count() == 0;
54 // pattern is not bound 55 // pattern is not bound