File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1060,13 +1060,15 @@ fn lint_or_fun_call<'a, 'tcx: 'a>(
1060
1060
1061
1061
impl < ' a , ' tcx > intravisit:: Visitor < ' tcx > for FunCallFinder < ' a , ' tcx > {
1062
1062
fn visit_expr ( & mut self , expr : & ' tcx hir:: Expr ) {
1063
- let found = match & expr. node {
1063
+ let call_found = match & expr. node {
1064
+ // ignore enum and struct constructors
1064
1065
hir:: ExprKind :: Call ( ..) => !is_ctor_function ( self . cx , expr) ,
1065
1066
hir:: ExprKind :: MethodCall ( ..) => true ,
1066
1067
_ => false ,
1067
1068
} ;
1068
1069
1069
- if found {
1070
+ if call_found {
1071
+ // don't lint for constant values
1070
1072
let owner_def = self . cx . tcx . hir ( ) . get_parent_did_by_hir_id ( expr. hir_id ) ;
1071
1073
let promotable = self
1072
1074
. cx
@@ -1162,7 +1164,6 @@ fn lint_or_fun_call<'a, 'tcx: 'a>(
1162
1164
return ;
1163
1165
}
1164
1166
1165
- // ignore enum and struct constructors
1166
1167
let mut finder = FunCallFinder { cx : & cx, found : false } ;
1167
1168
finder. visit_expr ( & arg) ;
1168
1169
if !finder. found {
You can’t perform that action at this time.
0 commit comments