Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

chore(rome_js_analyze): simplify comparison operator check #4076

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions crates/rome_js_analyze/src/analyzers/nursery/no_self_compare.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::utils::is_node_equal;
use rome_analyze::context::RuleContext;
use rome_analyze::{declare_rule, Ast, Rule, RuleDiagnostic};
use rome_js_syntax::{JsBinaryExpression, JsBinaryOperator};
use rome_js_syntax::JsBinaryExpression;
use rome_rowan::AstNode;

declare_rule! {
Expand Down Expand Up @@ -41,17 +41,7 @@ impl Rule for NoSelfCompare {
fn run(ctx: &RuleContext<Self>) -> Self::Signals {
let node = ctx.query();

if !matches!(
&node.operator(),
Ok(JsBinaryOperator::Equality
| JsBinaryOperator::Inequality
| JsBinaryOperator::GreaterThan
| JsBinaryOperator::GreaterThanOrEqual
| JsBinaryOperator::LessThan
| JsBinaryOperator::LessThanOrEqual
| JsBinaryOperator::StrictEquality
| JsBinaryOperator::StrictInequality)
) {
if !node.is_comparison_operator() {
return None;
}

Expand Down