Skip to content

Commit 9ec61d1

Browse files
committed
Update detector
1 parent 5eda4ac commit 9ec61d1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

third_party/move/tools/move-linter/src/model_ast_lints/simpler_bool_expression.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use move_compiler_v2::external_checks::ExpChecker;
2121
use move_model::{
2222
ast::{Exp, ExpData, Operation},
23-
model::GlobalEnv,
23+
model::FunctionEnv,
2424
};
2525
use ExpData::Call;
2626
use Operation::{And, Not, Or};
@@ -144,11 +144,13 @@ impl SimplerBoolExpression {
144144

145145
if is_negation_pair(left, right) || is_negation_pair(right, left) {
146146
let result_value = matches!(op, Or);
147-
Some(if result_value {
148-
SimplerBoolPatternType::Tautology
149-
} else {
150-
SimplerBoolPatternType::Contradiction
151-
})
147+
Some(
148+
if result_value {
149+
SimplerBoolPatternType::Tautology
150+
} else {
151+
SimplerBoolPatternType::Contradiction
152+
},
153+
)
152154
} else {
153155
None
154156
}
@@ -210,7 +212,9 @@ impl ExpChecker for SimplerBoolExpression {
210212
"simpler_bool_expression".to_string()
211213
}
212214

213-
fn visit_expr_pre(&mut self, env: &GlobalEnv, expr: &ExpData) {
215+
fn visit_expr_pre(&mut self, function_env: &FunctionEnv<'_>, expr: &ExpData) {
216+
let env = function_env.env();
217+
214218
let Call(id, op, args) = expr else { return };
215219

216220
let pattern = match op {

0 commit comments

Comments
 (0)