@@ -21,7 +21,7 @@ use syntax::symbol::{sym, LocalInternedString, Symbol};
21
21
use crate :: utils:: usage:: mutated_variables;
22
22
use crate :: utils:: {
23
23
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,
25
25
match_qpath, match_trait_method, match_type, match_var, method_calls, method_chain_args, paths, remove_blocks,
26
26
return_ty, same_tys, single_segment_path, snippet, snippet_with_applicability, snippet_with_macro_callsite,
27
27
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>(
1281
1281
fn visit_expr ( & mut self , expr : & ' tcx hir:: Expr ) {
1282
1282
let call_found = match & expr. kind {
1283
1283
// 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) ,
1285
1285
hir:: ExprKind :: MethodCall ( ..) => true ,
1286
1286
_ => false ,
1287
1287
} ;
1288
1288
1289
1289
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 ;
1300
1291
}
1301
1292
1302
1293
if !self . found {
0 commit comments