From df29effd59bb8971395419b79e8c0e51f373d4fb Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 29 Jan 2022 16:31:20 +0530 Subject: bump rnix to latest master, support nix 2.5 syntax --- lib/src/lints/bool_comparison.rs | 5 +++-- lib/src/lints/empty_pattern.rs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/src/lints') 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 { if let Some(bin_expr) = BinOp::cast(node.clone()); if let Some(lhs) = bin_expr.lhs(); if let Some(rhs) = bin_expr.rhs(); + if let Some(op) = bin_expr.operator(); - if let op@(BinOpKind::Equal | BinOpKind::NotEqual) = bin_expr.operator(); + if let BinOpKind::Equal | BinOpKind::NotEqual = op; let (non_bool_side, bool_side) = if boolean_ident(&lhs).is_some() { (rhs, lhs) } else if boolean_ident(&rhs).is_some() { @@ -70,7 +71,7 @@ impl Rule for BoolComparison { SyntaxKind::NODE_BIN_OP => { let inner = BinOp::cast(non_bool_side.clone()).unwrap(); // `!a ? b`, no paren required - if inner.operator() == BinOpKind::IsSet { + if inner.operator()? == BinOpKind::IsSet { make::unary_not(&non_bool_side).node().clone() } else { 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 { if let Some(body) = lambda_expr.body(); if let Some(pattern) = Pattern::cast(arg.clone()); + // no patterns within `{ }` if pattern.entries().count() == 0; // pattern is not bound -- cgit v1.2.3