@@ -21,7 +21,7 @@ use syntax::symbol::{sym, LocalInternedString, Symbol};
2121use crate :: utils:: usage:: mutated_variables;
2222use crate :: utils:: {
2323 get_arg_name, get_parent_expr, get_trait_def_id, has_iter_method, implements_trait, in_macro, is_copy,
24- is_ctor_function , is_expn_of, is_type_diagnostic_item, iter_input_pats, last_path_segment, match_def_path,
24+ is_ctor_or_promotable_const_function , is_expn_of, is_type_diagnostic_item, iter_input_pats, last_path_segment, match_def_path,
2525 match_qpath, match_trait_method, match_type, match_var, method_calls, method_chain_args, paths, remove_blocks,
2626 return_ty, same_tys, single_segment_path, snippet, snippet_with_applicability, snippet_with_macro_callsite,
2727 span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, sugg, walk_ptrs_ty,
@@ -1281,22 +1281,13 @@ fn lint_or_fun_call<'a, 'tcx>(
12811281 fn visit_expr ( & mut self , expr : & ' tcx hir:: Expr ) {
12821282 let call_found = match & expr. kind {
12831283 // ignore enum and struct constructors
1284- hir:: ExprKind :: Call ( ..) => !is_ctor_function ( self . cx , expr) ,
1284+ hir:: ExprKind :: Call ( ..) => !is_ctor_or_promotable_const_function ( self . cx , expr) ,
12851285 hir:: ExprKind :: MethodCall ( ..) => true ,
12861286 _ => false ,
12871287 } ;
12881288
12891289 if call_found {
1290- // don't lint for constant values
1291- let owner_def = self . cx . tcx . hir ( ) . get_parent_did ( expr. hir_id ) ;
1292- let promotable = self
1293- . cx
1294- . tcx
1295- . rvalue_promotable_map ( owner_def)
1296- . contains ( & expr. hir_id . local_id ) ;
1297- if !promotable {
1298- self . found |= true ;
1299- }
1290+ self . found |= true ;
13001291 }
13011292
13021293 if !self . found {
0 commit comments