@@ -7,7 +7,7 @@ use clippy_utils::sugg::Sugg;
77use clippy_utils:: ty:: implements_trait;
88use clippy_utils:: visitors:: is_const_evaluatable;
99use 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,
1111 peel_blocks_with_stmt, MaybePath ,
1212} ;
1313use itertools:: Itertools ;
@@ -146,7 +146,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualClamp {
146146 if !self . msrv . meets ( msrvs:: CLAMP ) {
147147 return ;
148148 }
149- if !expr. span . from_expansion ( ) && !in_constant ( cx, expr . hir_id ) {
149+ if !expr. span . from_expansion ( ) && !is_in_const_context ( cx) {
150150 let suggestion = is_if_elseif_else_pattern ( cx, expr)
151151 . or_else ( || is_max_min_pattern ( cx, expr) )
152152 . or_else ( || is_call_max_min_pattern ( cx, expr) )
@@ -159,7 +159,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualClamp {
159159 }
160160
161161 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) {
163163 return ;
164164 }
165165 for suggestion in is_two_if_pattern ( cx, block) {
0 commit comments