@@ -7,7 +7,7 @@ use clippy_utils::sugg::Sugg;
7
7
use clippy_utils:: ty:: implements_trait;
8
8
use clippy_utils:: visitors:: is_const_evaluatable;
9
9
use clippy_utils:: {
10
- eq_expr_value, in_constant , is_diag_trait_item , is_trait_method, path_res, path_to_local_id, peel_blocks,
10
+ eq_expr_value, is_diag_trait_item , is_in_const_context , is_trait_method, path_res, path_to_local_id, peel_blocks,
11
11
peel_blocks_with_stmt, MaybePath ,
12
12
} ;
13
13
use itertools:: Itertools ;
@@ -146,7 +146,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualClamp {
146
146
if !self . msrv . meets ( msrvs:: CLAMP ) {
147
147
return ;
148
148
}
149
- if !expr. span . from_expansion ( ) && !in_constant ( cx, expr . hir_id ) {
149
+ if !expr. span . from_expansion ( ) && !is_in_const_context ( cx) {
150
150
let suggestion = is_if_elseif_else_pattern ( cx, expr)
151
151
. or_else ( || is_max_min_pattern ( cx, expr) )
152
152
. or_else ( || is_call_max_min_pattern ( cx, expr) )
@@ -159,7 +159,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualClamp {
159
159
}
160
160
161
161
fn check_block ( & mut self , cx : & LateContext < ' tcx > , block : & ' tcx Block < ' tcx > ) {
162
- if !self . msrv . meets ( msrvs:: CLAMP ) || in_constant ( cx, block . hir_id ) {
162
+ if !self . msrv . meets ( msrvs:: CLAMP ) || is_in_const_context ( cx) {
163
163
return ;
164
164
}
165
165
for suggestion in is_two_if_pattern ( cx, block) {
0 commit comments