From 5c06cf64cddbe537bcc992231d94b9211b067ece Mon Sep 17 00:00:00 2001 From: Tom Cat <48447545+tx-tomcat@users.noreply.github.com> Date: Sat, 7 Dec 2024 04:14:06 +0700 Subject: [PATCH] [Linter] Combinable bool conditions (#16479) ## Description The rules detects and warns about comparison operations in Move code that can be simplified. It identifies comparisons over the same operands joined with a boolean operation, and suggests how to collapse them to a single operation. # Testing - New tests added ## Release notes - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [X] CLI: Move will now lint against pairs of comparison operations that can be combined to a single comparison. - [ ] Rust SDK: --------- Co-authored-by: jamedzung Co-authored-by: Todd Nowacki --- .../crates/move-compiler/src/cfgir/visitor.rs | 7 +- .../src/linters/combinable_comparisons.rs | 237 ++++ .../crates/move-compiler/src/linters/mod.rs | 8 + .../move-compiler/src/typing/visitor.rs | 126 +- ...false_negative_combinable_comparisons.move | 7 + .../suppress_combinable_comparisons.move | 17 + .../true_positive_combinable_comparisons.exp | 1136 +++++++++++++++++ .../true_positive_combinable_comparisons.move | 161 +++ 8 files changed, 1694 insertions(+), 5 deletions(-) create mode 100644 external-crates/move/crates/move-compiler/src/linters/combinable_comparisons.rs create mode 100644 external-crates/move/crates/move-compiler/tests/linter/false_negative_combinable_comparisons.move create mode 100644 external-crates/move/crates/move-compiler/tests/linter/suppress_combinable_comparisons.move create mode 100644 external-crates/move/crates/move-compiler/tests/linter/true_positive_combinable_comparisons.exp create mode 100644 external-crates/move/crates/move-compiler/tests/linter/true_positive_combinable_comparisons.move diff --git a/external-crates/move/crates/move-compiler/src/cfgir/visitor.rs b/external-crates/move/crates/move-compiler/src/cfgir/visitor.rs index 45c832cf254ac..839498650092f 100644 --- a/external-crates/move/crates/move-compiler/src/cfgir/visitor.rs +++ b/external-crates/move/crates/move-compiler/src/cfgir/visitor.rs @@ -949,6 +949,10 @@ pub fn same_value_exp(e1: &H::Exp, e2: &H::Exp) -> bool { pub fn same_value_exp_(e1: &H::UnannotatedExp_, e2: &H::UnannotatedExp_) -> bool { use H::UnannotatedExp_ as E; match (e1, e2) { + (E::Dereference(e) | E::Freeze(e), other) | (other, E::Dereference(e) | E::Freeze(e)) => { + same_value_exp_(&e.exp.value, other) + } + (E::Value(v1), E::Value(v2)) => v1 == v2, (E::Unit { .. }, E::Unit { .. }) => true, (E::Constant(c1), E::Constant(c2)) => c1 == c2, @@ -965,9 +969,6 @@ pub fn same_value_exp_(e1: &H::UnannotatedExp_, e2: &H::UnannotatedExp_) -> bool .all(|(e1, e2)| same_value_exp(e1, e2)) } - (E::Dereference(e) | E::Freeze(e), other) | (other, E::Dereference(e) | E::Freeze(e)) => { - same_value_exp_(&e.exp.value, other) - } (E::UnaryExp(op1, e1), E::UnaryExp(op2, e2)) => op1 == op2 && same_value_exp(e1, e2), (E::BinopExp(l1, op1, r1), E::BinopExp(l2, op2, r2)) => { op1 == op2 && same_value_exp(l1, l2) && same_value_exp(r1, r2) diff --git a/external-crates/move/crates/move-compiler/src/linters/combinable_comparisons.rs b/external-crates/move/crates/move-compiler/src/linters/combinable_comparisons.rs new file mode 100644 index 0000000000000..c98ce81a0196f --- /dev/null +++ b/external-crates/move/crates/move-compiler/src/linters/combinable_comparisons.rs @@ -0,0 +1,237 @@ +// Copyright (c) The Move Contributors +// SPDX-License-Identifier: Apache-2.0 + +//! The `CombinableBool` detects and warns about boolean conditions in Move code that can be simplified. +//! It identifies comparisons that are logically equivalent and suggests more concise alternatives. +//! This rule focuses on simplifying expressions involving `==`, `<`, `>`, and `!=` operators to improve code readability. + +use crate::{ + diag, + linters::StyleCodes, + parser::ast::{BinOp, BinOp_}, + typing::{ + ast::{self as T}, + visitor::{same_value_exp, simple_visitor}, + }, +}; + +#[derive(Debug, Clone, Copy)] +enum Simplification { + Reducible(CmpOp), + AlwaysTrue, + AlwaysFalse, +} + +#[derive(Debug, Clone, Copy)] +enum BoolOp { + And, + Or, +} + +/// See `simplify` for how these values are used. +#[repr(u8)] +#[derive(Debug, Clone, Copy)] +enum CmpOp { + Lt = LT, + Eq = EQ, + Le = LE, + Gt = GT, + Neq = NEQ, + Ge = GE, +} + +// See `simplify` for how these values are used. +const FALSE: u8 = 0b000; +const LT: u8 = 0b001; +const EQ: u8 = 0b010; +const LE: u8 = 0b011; +const GT: u8 = 0b100; +const NEQ: u8 = 0b101; +const GE: u8 = 0b110; +const TRUE: u8 = 0b111; + +simple_visitor!( + CombinableComparisons, + fn visit_exp_custom(&mut self, exp: &T::Exp) -> bool { + use T::UnannotatedExp_ as E; + let E::BinopExp(outer_l, outer_bop, _, outer_r) = &exp.exp.value else { + return false; + }; + // TODO handle negation + let E::BinopExp(l1, op_l, _, r1) = &outer_l.exp.value else { + return false; + }; + let E::BinopExp(l2, op_r, _, r2) = &outer_r.exp.value else { + return false; + }; + let Some((outer, inner_l, inner_r)) = binop_case(outer_bop, l1, op_l, r1, l2, op_r, r2) + else { + return false; + }; + let simplification = simplify(outer, inner_l, inner_r); + let msg = match simplification { + Simplification::Reducible(inner_op) => { + format!("simplifies to the operation '{}'", inner_op) + } + Simplification::AlwaysTrue => "is always 'true'".to_string(), + Simplification::AlwaysFalse => "is always 'false'".to_string(), + }; + self.reporter.add_diag(diag!( + StyleCodes::CombinableComparisons.diag_info(), + (exp.exp.loc, format!("This comparison {msg}")), + )); + + false + } +); + +/// Each binary operator is represented as a 3-bit number where each bit represents a range of +/// possible values. With three bits, 0bGEL we are "drawing" an interval of ranges. The comparison +/// `true` if the value is within the interval. so for `x cmp y`` +/// ```text +/// G E L +/// ^ this bit represents x < y (less than the equal bit) +/// ^ this bit represents x == y (the equal bit) +/// ^ this bit represents x > y (greater than the equal bit) +/// ``` +/// We then take the disjunction of intervals by the bits--creating a bitset. +/// So for example, `>=` is 0b110 since the interval is either greater OR equal. +/// And for `!=` is 0b101 since the interval is either not equal OR less than. We are only dealing +/// with primitives so we know the values are well ordered. +/// From there we can then bitwise-or the bits (set union) when the outer operation is `||` and +/// bitwise-and the bits (set intersection) when the outer operation is `&&` to get the final +/// "simplified" operation. If all bits are set, then the operation is always true. If no bits are +/// set, then the operation is always false. +fn simplify(outer: BoolOp, inner_l: CmpOp, inner_r: CmpOp) -> Simplification { + let lbits = inner_l as u8; + let rbits = inner_r as u8; + let simplification = match outer { + BoolOp::And => lbits & rbits, + BoolOp::Or => lbits | rbits, + }; + match simplification { + FALSE => Simplification::AlwaysFalse, + LT => Simplification::Reducible(CmpOp::Lt), + EQ => Simplification::Reducible(CmpOp::Eq), + LE => Simplification::Reducible(CmpOp::Le), + GT => Simplification::Reducible(CmpOp::Gt), + NEQ => Simplification::Reducible(CmpOp::Neq), + GE => Simplification::Reducible(CmpOp::Ge), + TRUE => Simplification::AlwaysTrue, + _ => unreachable!(), + } +} + +fn bool_op(sp!(_, bop_): &BinOp) -> Option { + Some(match bop_ { + BinOp_::And => BoolOp::And, + BinOp_::Or => BoolOp::Or, + BinOp_::Eq + | BinOp_::Lt + | BinOp_::Gt + | BinOp_::Le + | BinOp_::Ge + | BinOp_::Add + | BinOp_::Sub + | BinOp_::Mul + | BinOp_::Mod + | BinOp_::Div + | BinOp_::BitOr + | BinOp_::BitAnd + | BinOp_::Xor + | BinOp_::Shl + | BinOp_::Shr + | BinOp_::Range + | BinOp_::Implies + | BinOp_::Iff + | BinOp_::Neq => return None, + }) +} + +fn cmp_op(sp!(_, bop_): &BinOp) -> Option { + Some(match bop_ { + BinOp_::Eq => CmpOp::Eq, + BinOp_::Neq => CmpOp::Neq, + BinOp_::Lt => CmpOp::Lt, + BinOp_::Gt => CmpOp::Gt, + BinOp_::Le => CmpOp::Le, + BinOp_::Ge => CmpOp::Ge, + + BinOp_::Add + | BinOp_::Sub + | BinOp_::Mul + | BinOp_::Mod + | BinOp_::Div + | BinOp_::BitOr + | BinOp_::BitAnd + | BinOp_::Xor + | BinOp_::Shl + | BinOp_::Shr + | BinOp_::Range + | BinOp_::Implies + | BinOp_::Iff + | BinOp_::And + | BinOp_::Or => return None, + }) +} + +fn flip(op: CmpOp) -> CmpOp { + match op { + CmpOp::Eq => CmpOp::Eq, + CmpOp::Neq => CmpOp::Neq, + CmpOp::Lt => CmpOp::Gt, + CmpOp::Gt => CmpOp::Lt, + CmpOp::Le => CmpOp::Ge, + CmpOp::Ge => CmpOp::Le, + } +} + +fn binop_case( + outer_bop: &BinOp, + l1: &T::Exp, + op_l: &BinOp, + r1: &T::Exp, + l2: &T::Exp, + op_r: &BinOp, + r2: &T::Exp, +) -> Option<(BoolOp, CmpOp, CmpOp)> { + let outer = bool_op(outer_bop)?; + let inner_l = cmp_op(op_l)?; + let inner_r = cmp_op(op_r)?; + let (inner_l, inner_r) = operand_case(l1, inner_l, r1, l2, inner_r, r2)?; + Some((outer, inner_l, inner_r)) +} + +fn operand_case( + l1: &T::Exp, + op1: CmpOp, + r1: &T::Exp, + l2: &T::Exp, + op2: CmpOp, + r2: &T::Exp, +) -> Option<(CmpOp, CmpOp)> { + if same_value_exp(l1, l2) && same_value_exp(r1, r2) { + Some((op1, op2)) + } else if same_value_exp(l1, r2) && same_value_exp(r1, l2) { + Some((op1, flip(op2))) + } else { + None + } +} + +impl std::fmt::Display for CmpOp { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + CmpOp::Eq => "==", + CmpOp::Neq => "!=", + CmpOp::Lt => "<", + CmpOp::Gt => ">", + CmpOp::Le => "<=", + CmpOp::Ge => ">=", + } + ) + } +} diff --git a/external-crates/move/crates/move-compiler/src/linters/mod.rs b/external-crates/move/crates/move-compiler/src/linters/mod.rs index aede1dc108ade..c0a6784638608 100644 --- a/external-crates/move/crates/move-compiler/src/linters/mod.rs +++ b/external-crates/move/crates/move-compiler/src/linters/mod.rs @@ -14,6 +14,7 @@ use crate::{ }; pub mod abort_constant; +pub mod combinable_comparisons; pub mod constant_naming; pub mod equal_operands; pub mod loop_without_exit; @@ -169,6 +170,12 @@ lints!( "always_equal_operands", "redundant, always-equal operands for binary operation" ), + ( + CombinableComparisons, + LinterDiagnosticCategory::Complexity, + "combinable_comparisons", + "comparison operations condition can be simplified" + ) ); pub const ALLOW_ATTR_CATEGORY: &str = "lint"; @@ -207,6 +214,7 @@ pub fn linter_visitors(level: LintLevel) -> Vec { redundant_ref_deref::RedundantRefDeref.visitor(), unnecessary_unit::UnnecessaryUnit.visitor(), equal_operands::EqualOperands.visitor(), + combinable_comparisons::CombinableComparisons.visitor(), ] } } diff --git a/external-crates/move/crates/move-compiler/src/typing/visitor.rs b/external-crates/move/crates/move-compiler/src/typing/visitor.rs index 2dcf75d334eae..4fe015d236f7e 100644 --- a/external-crates/move/crates/move-compiler/src/typing/visitor.rs +++ b/external-crates/move/crates/move-compiler/src/typing/visitor.rs @@ -4,11 +4,11 @@ use crate::{ command_line::compiler::Visitor, diagnostics::warning_filters::WarningFilters, - expansion::ast::ModuleIdent, + expansion::ast::{Fields, ModuleIdent}, naming::ast::{self as N, Var}, parser::ast::{ConstantName, DatatypeName, FunctionName, VariantName}, shared::CompilationEnv, - typing::ast as T, + typing::ast::{self as T, BuiltinFunction_}, }; use move_ir_types::location::Loc; use move_proc_macros::growing_stack; @@ -1286,3 +1286,125 @@ fn same_local_(lhs: &Var, rhs: &T::UnannotatedExp_) -> bool { _ => false, } } + +/// Assumes equal types and as such will not check type arguments for equality. +/// Assumes function calls, assignments, and similar expressions are effectful and thus not equal. +pub fn same_value_exp(e1: &T::Exp, e2: &T::Exp) -> bool { + same_value_exp_(&e1.exp.value, &e2.exp.value) +} + +#[growing_stack] +pub fn same_value_exp_(e1: &T::UnannotatedExp_, e2: &T::UnannotatedExp_) -> bool { + use T::UnannotatedExp_ as E; + macro_rules! effectful { + () => { + E::Builtin(_, _) + | E::ModuleCall(_) + | E::Assign(_, _, _) + | E::Mutate(_, _) + | E::Return(_) + | E::Abort(_) + | E::Give(_, _) + }; + } + macro_rules! brittle { + () => { + E::ErrorConstant { .. } + | E::IfElse(_, _, _) + | E::Match(_, _) + | E::VariantMatch(_, _, _) + | E::While(_, _, _) + | E::Loop { .. } + }; + } + match (e1, e2) { + (E::Dereference(e) | E::TempBorrow(_, e) | E::Cast(e, _) | E::Annotate(e, _), other) + | (other, E::Dereference(e) | E::TempBorrow(_, e) | E::Cast(e, _) | E::Annotate(e, _)) => { + same_value_exp_(&e.exp.value, other) + } + (E::NamedBlock(_, s) | E::Block(s), other) | (other, E::NamedBlock(_, s) | E::Block(s)) => { + same_value_seq_exp_(s, other) + } + (E::ExpList(l), other) | (other, E::ExpList(l)) if l.len() == 1 => match &l[0] { + T::ExpListItem::Single(e, _) => same_value_exp_(&e.exp.value, other), + T::ExpListItem::Splat(_, e, _) => same_value_exp_(&e.exp.value, other), + }, + + (E::Value(v1), E::Value(v2)) => v1 == v2, + (E::Unit { .. }, E::Unit { .. }) => true, + (E::Constant(m1, c1), E::Constant(m2, c2)) => m1 == m2 && c1 == c2, + ( + E::Move { var, .. } | E::Copy { var, .. } | E::Use(var) | E::BorrowLocal(_, var), + other, + ) + | ( + other, + E::Move { var, .. } | E::Copy { var, .. } | E::Use(var) | E::BorrowLocal(_, var), + ) => same_local_(var, other), + + (E::Vector(_, _, _, e1), E::Vector(_, _, _, e2)) => same_value_exp(e1, e2), + + (E::Builtin(b, e), other) | (other, E::Builtin(b, e)) + if matches!(&b.value, BuiltinFunction_::Freeze(_)) => + { + same_value_exp_(&e.exp.value, other) + } + + (E::ExpList(l1), E::ExpList(l2)) => same_value_exp_list(l1, l2), + + (E::UnaryExp(op1, e1), E::UnaryExp(op2, e2)) => op1 == op2 && same_value_exp(e1, e2), + (E::BinopExp(l1, op1, _, r1), E::BinopExp(l2, op2, _, r2)) => { + op1 == op2 && same_value_exp(l1, l2) && same_value_exp(r1, r2) + } + + (E::Pack(m1, n1, _, fields1), E::Pack(m2, n2, _, fields2)) => { + m1 == m2 && n1 == n2 && same_value_fields(fields1, fields2) + } + (E::PackVariant(m1, n1, v1, _, fields1), E::PackVariant(m2, n2, v2, _, fields2)) => { + m1 == m2 && n1 == n2 && v1 == v2 && same_value_fields(fields1, fields2) + } + + (E::Borrow(_, e1, f1), E::Borrow(_, e2, f2)) => f1 == f2 && same_value_exp(e1, e2), + + // false for anything effectful + (effectful!(), _) | (_, effectful!()) => false, + + // TODO there is some potential for equality here, but a bit too brittle now + (brittle!(), _) | (_, brittle!()) => false, + + _ => false, + } +} + +fn same_value_fields( + fields1: &Fields<(N::Type, T::Exp)>, + fields2: &Fields<(N::Type, T::Exp)>, +) -> bool { + fields1.key_cloned_iter().all(|(f1, (_, (_, e1)))| { + fields2 + .get(&f1) + .is_some_and(|(_, (_, e2))| same_value_exp(e1, e2)) + }) +} + +fn same_value_exp_list(l1: &[T::ExpListItem], l2: &[T::ExpListItem]) -> bool { + l1.len() == l2.len() + && l1.iter().zip(l2).all(|(i1, i2)| match (i1, i2) { + (T::ExpListItem::Single(e1, _), T::ExpListItem::Single(e2, _)) => { + same_value_exp(e1, e2) + } + // TODO handle splat + _ => false, + }) +} + +fn same_value_seq_exp_((_, seq_): &T::Sequence, other: &T::UnannotatedExp_) -> bool { + match seq_.len() { + 0 => panic!("ICE should not have empty sequence"), + 1 => match &seq_[0].value { + T::SequenceItem_::Seq(e) => same_value_exp_(&e.exp.value, other), + _ => false, + }, + _ => false, + } +} diff --git a/external-crates/move/crates/move-compiler/tests/linter/false_negative_combinable_comparisons.move b/external-crates/move/crates/move-compiler/tests/linter/false_negative_combinable_comparisons.move new file mode 100644 index 0000000000000..4df6ba1a675ec --- /dev/null +++ b/external-crates/move/crates/move-compiler/tests/linter/false_negative_combinable_comparisons.move @@ -0,0 +1,7 @@ +// tests lints against combinable comparisons that can be simplified to a single comparison. +// these cases should work but do not +module a::m { + fun negated(x: u64, y: u64) { + !(x == y) || x > y; + } +} diff --git a/external-crates/move/crates/move-compiler/tests/linter/suppress_combinable_comparisons.move b/external-crates/move/crates/move-compiler/tests/linter/suppress_combinable_comparisons.move new file mode 100644 index 0000000000000..48a47ff5e1a70 --- /dev/null +++ b/external-crates/move/crates/move-compiler/tests/linter/suppress_combinable_comparisons.move @@ -0,0 +1,17 @@ +#[allow(lint(combinable_comparisons))] +module a::m { + fun t(x: u64, y: u64): bool { + x > y || x == y + } +} + + +module a::n { + #[allow(lint(combinable_comparisons))] + const C: bool = 5 > 3 || 5 == 3; + + #[allow(lint(combinable_comparisons))] + fun t(x: u64, y: u64): bool { + x > y || x == y + } +} diff --git a/external-crates/move/crates/move-compiler/tests/linter/true_positive_combinable_comparisons.exp b/external-crates/move/crates/move-compiler/tests/linter/true_positive_combinable_comparisons.exp new file mode 100644 index 0000000000000..45d20929184be --- /dev/null +++ b/external-crates/move/crates/move-compiler/tests/linter/true_positive_combinable_comparisons.exp @@ -0,0 +1,1136 @@ +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:4:9 + │ +4 │ x == y && x != y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:5:9 + │ +5 │ x == y && x > y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:6:9 + │ +6 │ x == y && x < y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:7:9 + │ +7 │ x == y && x >= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:8:9 + │ +8 │ x == y && x <= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:9:9 + │ +9 │ x != y && x > y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:10:9 + │ +10 │ x != y && x < y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:11:9 + │ +11 │ x != y && x >= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:12:9 + │ +12 │ x != y && x <= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:13:9 + │ +13 │ x > y && x < y; + │ ^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:14:9 + │ +14 │ x > y && x >= y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:15:9 + │ +15 │ x > y && x <= y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:16:9 + │ +16 │ x < y && x >= y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:17:9 + │ +17 │ x < y && x <= y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:18:9 + │ +18 │ x >= y && x <= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:19:9 + │ +19 │ x == y || x != y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:20:9 + │ +20 │ x == y || x > y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:21:9 + │ +21 │ x == y || x < y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:22:9 + │ +22 │ x == y || x >= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:23:9 + │ +23 │ x == y || x <= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:24:9 + │ +24 │ x != y || x > y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:25:9 + │ +25 │ x != y || x < y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:26:9 + │ +26 │ x != y || x >= y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:27:9 + │ +27 │ x != y || x <= y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:28:9 + │ +28 │ x > y || x < y; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:29:9 + │ +29 │ x > y || x >= y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:30:9 + │ +30 │ x > y || x <= y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:31:9 + │ +31 │ x < y || x >= y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:32:9 + │ +32 │ x < y || x <= y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:33:9 + │ +33 │ x >= y || x <= y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:34:9 + │ +34 │ x != y && x == y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:35:9 + │ +35 │ x > y && x == y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:36:9 + │ +36 │ x < y && x == y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:37:9 + │ +37 │ x >= y && x == y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:38:9 + │ +38 │ x <= y && x == y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:39:9 + │ +39 │ x > y && x != y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:40:9 + │ +40 │ x < y && x != y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:41:9 + │ +41 │ x >= y && x != y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:42:9 + │ +42 │ x <= y && x != y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:43:9 + │ +43 │ x < y && x > y; + │ ^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:44:9 + │ +44 │ x >= y && x > y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:45:9 + │ +45 │ x <= y && x > y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:46:9 + │ +46 │ x >= y && x < y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:47:9 + │ +47 │ x <= y && x < y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:48:9 + │ +48 │ x <= y && x >= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:49:9 + │ +49 │ x != y || x == y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:50:9 + │ +50 │ x > y || x == y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:51:9 + │ +51 │ x < y || x == y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:52:9 + │ +52 │ x >= y || x == y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:53:9 + │ +53 │ x <= y || x == y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:54:9 + │ +54 │ x > y || x != y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:55:9 + │ +55 │ x < y || x != y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:56:9 + │ +56 │ x >= y || x != y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:57:9 + │ +57 │ x <= y || x != y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:58:9 + │ +58 │ x < y || x > y; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:59:9 + │ +59 │ x >= y || x > y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:60:9 + │ +60 │ x <= y || x > y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:61:9 + │ +61 │ x >= y || x < y; + │ ^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:62:9 + │ +62 │ x <= y || x < y; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:63:9 + │ +63 │ x <= y || x >= y; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:67:9 + │ +67 │ x == y && y != x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:68:9 + │ +68 │ x == y && y > x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:69:9 + │ +69 │ x == y && y < x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:70:9 + │ +70 │ x == y && y >= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:71:9 + │ +71 │ x == y && y <= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:72:9 + │ +72 │ x != y && y > x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:73:9 + │ +73 │ x != y && y < x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:74:9 + │ +74 │ x != y && y >= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:75:9 + │ +75 │ x != y && y <= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:76:9 + │ +76 │ x > y && y > x; + │ ^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:77:9 + │ +77 │ x > y && y >= x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:78:9 + │ +78 │ x > y && y <= x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:79:9 + │ +79 │ x < y && y >= x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:80:9 + │ +80 │ x < y && y <= x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:81:9 + │ +81 │ x >= y && y >= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:82:9 + │ +82 │ x == y || y != x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:83:9 + │ +83 │ x == y || y > x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:84:9 + │ +84 │ x == y || y < x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:85:9 + │ +85 │ x == y || y >= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:86:9 + │ +86 │ x == y || y <= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:87:9 + │ +87 │ x != y || y > x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:88:9 + │ +88 │ x != y || y < x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:89:9 + │ +89 │ x != y || y >= x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:90:9 + │ +90 │ x != y || y <= x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:91:9 + │ +91 │ x > y || y > x; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:92:9 + │ +92 │ x > y || y >= x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:93:9 + │ +93 │ x > y || y <= x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:94:9 + │ +94 │ x < y || y >= x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:95:9 + │ +95 │ x < y || y <= x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:96:9 + │ +96 │ x >= y || y >= x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:97:9 + │ +97 │ x != y && y == x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:98:9 + │ +98 │ x > y && y == x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:99:9 + │ +99 │ x < y && y == x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:100:9 + │ +100 │ x >= y && y == x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:101:9 + │ +101 │ x <= y && y == x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:102:9 + │ +102 │ x > y && y != x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:103:9 + │ +103 │ x < y && y != x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:104:9 + │ +104 │ x >= y && y != x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:105:9 + │ +105 │ x <= y && y != x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:106:9 + │ +106 │ x < y && y < x; + │ ^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:107:9 + │ +107 │ x >= y && y > x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:108:9 + │ +108 │ x <= y && y > x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:109:9 + │ +109 │ x >= y && y < x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:110:9 + │ +110 │ x <= y && y < x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'false' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:111:9 + │ +111 │ x <= y && y <= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:112:9 + │ +112 │ x != y || y == x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:113:9 + │ +113 │ x > y || y == x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:114:9 + │ +114 │ x < y || y == x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:115:9 + │ +115 │ x >= y || y == x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:116:9 + │ +116 │ x <= y || y == x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:117:9 + │ +117 │ x > y || y != x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:118:9 + │ +118 │ x < y || y != x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:119:9 + │ +119 │ x >= y || y != x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:120:9 + │ +120 │ x <= y || y != x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:121:9 + │ +121 │ x < y || y < x; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:122:9 + │ +122 │ x >= y || y > x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:123:9 + │ +123 │ x <= y || y > x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:124:9 + │ +124 │ x >= y || y < x; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:125:9 + │ +125 │ x <= y || y < x; + │ ^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:126:9 + │ +126 │ x <= y || y <= x; + │ ^^^^^^^^^^^^^^^^ This comparison is always 'true' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:130:9 + │ +130 │ x == y && x == y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:131:9 + │ +131 │ x != y && x != y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:132:9 + │ +132 │ x > y && x > y; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:133:9 + │ +133 │ x < y && x < y; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:134:9 + │ +134 │ x >= y && x >= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:135:9 + │ +135 │ x <= y && x <= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:136:9 + │ +136 │ x == y || x == y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:137:9 + │ +137 │ x != y || x != y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:138:9 + │ +138 │ x > y || x > y; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:139:9 + │ +139 │ x < y || x < y; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:140:9 + │ +140 │ x >= y || x >= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:141:9 + │ +141 │ x <= y || x <= y; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:142:9 + │ +142 │ x == y && y == x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '==' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:143:9 + │ +143 │ x != y && y != x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '!=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:144:9 + │ +144 │ x > y && y < x; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:145:9 + │ +145 │ x < y && y > x; + │ ^^^^^^^^^^^^^^ This comparison simplifies to the operation '<' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:146:9 + │ +146 │ x >= y && y <= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:147:9 + │ +147 │ x <= y && y >= x; + │ ^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:150:26 + │ +150 │ const Values: bool = 5 > 3 || 5 == 3; + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:153:9 + │ +153 │ 5 != 3 && 5 > 3 + │ ^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:158:9 + │ +158 │ {&x} == &y || (x as u64) > (*&y:u64); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '>=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + +warning[Lint W01012]: comparison operations condition can be simplified + ┌─ tests/linter/true_positive_combinable_comparisons.move:159:9 + │ +159 │ © x == &y || x < move y; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ This comparison simplifies to the operation '<=' + │ + = This warning can be suppressed with '#[allow(lint(combinable_comparisons))]' applied to the 'module' or module member ('const', 'fun', or 'struct') + diff --git a/external-crates/move/crates/move-compiler/tests/linter/true_positive_combinable_comparisons.move b/external-crates/move/crates/move-compiler/tests/linter/true_positive_combinable_comparisons.move new file mode 100644 index 0000000000000..4f209cb586457 --- /dev/null +++ b/external-crates/move/crates/move-compiler/tests/linter/true_positive_combinable_comparisons.move @@ -0,0 +1,161 @@ +// tests lints against combinable comparisons that can be simplified to a single comparison. +module a::m { + fun t(x: u64, y: u64) { + x == y && x != y; + x == y && x > y; + x == y && x < y; + x == y && x >= y; + x == y && x <= y; + x != y && x > y; + x != y && x < y; + x != y && x >= y; + x != y && x <= y; + x > y && x < y; + x > y && x >= y; + x > y && x <= y; + x < y && x >= y; + x < y && x <= y; + x >= y && x <= y; + x == y || x != y; + x == y || x > y; + x == y || x < y; + x == y || x >= y; + x == y || x <= y; + x != y || x > y; + x != y || x < y; + x != y || x >= y; + x != y || x <= y; + x > y || x < y; + x > y || x >= y; + x > y || x <= y; + x < y || x >= y; + x < y || x <= y; + x >= y || x <= y; + x != y && x == y; + x > y && x == y; + x < y && x == y; + x >= y && x == y; + x <= y && x == y; + x > y && x != y; + x < y && x != y; + x >= y && x != y; + x <= y && x != y; + x < y && x > y; + x >= y && x > y; + x <= y && x > y; + x >= y && x < y; + x <= y && x < y; + x <= y && x >= y; + x != y || x == y; + x > y || x == y; + x < y || x == y; + x >= y || x == y; + x <= y || x == y; + x > y || x != y; + x < y || x != y; + x >= y || x != y; + x <= y || x != y; + x < y || x > y; + x >= y || x > y; + x <= y || x > y; + x >= y || x < y; + x <= y || x < y; + x <= y || x >= y; + } + + fun flipped(x: u64, y: u64) { + x == y && y != x; + x == y && y > x; + x == y && y < x; + x == y && y >= x; + x == y && y <= x; + x != y && y > x; + x != y && y < x; + x != y && y >= x; + x != y && y <= x; + x > y && y > x; + x > y && y >= x; + x > y && y <= x; + x < y && y >= x; + x < y && y <= x; + x >= y && y >= x; + x == y || y != x; + x == y || y > x; + x == y || y < x; + x == y || y >= x; + x == y || y <= x; + x != y || y > x; + x != y || y < x; + x != y || y >= x; + x != y || y <= x; + x > y || y > x; + x > y || y >= x; + x > y || y <= x; + x < y || y >= x; + x < y || y <= x; + x >= y || y >= x; + x != y && y == x; + x > y && y == x; + x < y && y == x; + x >= y && y == x; + x <= y && y == x; + x > y && y != x; + x < y && y != x; + x >= y && y != x; + x <= y && y != x; + x < y && y < x; + x >= y && y > x; + x <= y && y > x; + x >= y && y < x; + x <= y && y < x; + x <= y && y <= x; + x != y || y == x; + x > y || y == x; + x < y || y == x; + x >= y || y == x; + x <= y || y == x; + x > y || y != x; + x < y || y != x; + x >= y || y != x; + x <= y || y != x; + x < y || y < x; + x >= y || y > x; + x <= y || y > x; + x >= y || y < x; + x <= y || y < x; + x <= y || y <= x; + } + + fun same_op(x: u64, y: u64) { + x == y && x == y; + x != y && x != y; + x > y && x > y; + x < y && x < y; + x >= y && x >= y; + x <= y && x <= y; + x == y || x == y; + x != y || x != y; + x > y || x > y; + x < y || x < y; + x >= y || x >= y; + x <= y || x <= y; + x == y && y == x; + x != y && y != x; + x > y && y < x; + x < y && y > x; + x >= y && y <= x; + x <= y && y >= x; + } + + const Values: bool = 5 > 3 || 5 == 3; + + fun values(): bool { + 5 != 3 && 5 > 3 + } + + #[allow(lint(redundant_ref_deref))] + fun mismatched(x: u64, y: u64) { + {&x} == &y || (x as u64) > (*&y:u64); + © x == &y || x < move y; + } +}