@@ -20,11 +20,11 @@ use syntax::symbol::LocalInternedString;
2020use crate :: utils:: paths;
2121use crate :: utils:: sugg;
2222use crate :: utils:: {
23- get_arg_name, get_parent_expr, get_trait_def_id, has_iter_method, implements_trait, in_macro, is_copy, is_expn_of ,
24- is_self, is_self_ty, iter_input_pats, last_path_segment, match_path, match_qpath, match_trait_method , match_type ,
25- match_var, method_calls, method_chain_args, remove_blocks, return_ty, same_tys, single_segment_path , snippet ,
26- snippet_with_applicability , snippet_with_macro_callsite , span_lint , span_lint_and_sugg , span_lint_and_then ,
27- span_note_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth, SpanlessEq ,
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_self, is_self_ty, iter_input_pats, last_path_segment, match_path, match_qpath,
25+ match_trait_method , match_type , match_var, method_calls, method_chain_args, remove_blocks, return_ty, same_tys,
26+ single_segment_path , snippet , snippet_with_applicability , snippet_with_macro_callsite , span_lint ,
27+ span_lint_and_sugg , span_lint_and_then , span_note_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth, SpanlessEq ,
2828} ;
2929
3030declare_clippy_lint ! {
@@ -1072,6 +1072,11 @@ fn lint_or_fun_call(cx: &LateContext<'_, '_>, expr: &hir::Expr, method_span: Spa
10721072 return ;
10731073 }
10741074
1075+ // ignore enum and struct constructors
1076+ if is_ctor_function ( cx, & arg) {
1077+ return ;
1078+ }
1079+
10751080 // don't lint for constant values
10761081 let owner_def = cx. tcx . hir ( ) . get_parent_did_by_hir_id ( arg. hir_id ) ;
10771082 let promotable = cx. tcx . rvalue_promotable_map ( owner_def) . contains ( & arg. hir_id . local_id ) ;
0 commit comments