@@ -20,11 +20,11 @@ use syntax::symbol::LocalInternedString;
20
20
use crate :: utils:: paths;
21
21
use crate :: utils:: sugg;
22
22
use 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 ,
28
28
} ;
29
29
30
30
declare_clippy_lint ! {
@@ -1072,6 +1072,11 @@ fn lint_or_fun_call(cx: &LateContext<'_, '_>, expr: &hir::Expr, method_span: Spa
1072
1072
return ;
1073
1073
}
1074
1074
1075
+ // ignore enum and struct constructors
1076
+ if is_ctor_function ( cx, & arg) {
1077
+ return ;
1078
+ }
1079
+
1075
1080
// don't lint for constant values
1076
1081
let owner_def = cx. tcx . hir ( ) . get_parent_did_by_hir_id ( arg. hir_id ) ;
1077
1082
let promotable = cx. tcx . rvalue_promotable_map ( owner_def) . contains ( & arg. hir_id . local_id ) ;
0 commit comments