File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,9 @@ impl<'tcx> LateLintPass<'tcx> for TypeCosplay {
73
73
if let ExprKind :: Call ( fnc_expr, args_exprs) = expr. kind;
74
74
// TODO: recommended-2 case will exit early since it contains a reference to AccountInfo.data,
75
75
// not a direct argument. In general, any references will fail
76
+ // smoelius: I updated the `recommended-2` test so that the call contains a reference to
77
+ // `AccountInfo.data`. But @victor-wei126's comment is still relevant in that we need a
78
+ // more general solution for finding references to `AccountInfo.data`.
76
79
if args_exprs. iter( ) . any( |arg| {
77
80
visit_expr_no_bodies( arg, |expr| contains_data_field_reference( cx, expr) )
78
81
} ) ;
@@ -158,7 +161,7 @@ fn contains_data_field_reference(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool
158
161
if_chain ! {
159
162
if let ExprKind :: Field ( obj_expr, ident) = expr. kind;
160
163
if ident. as_str( ) == "data" ;
161
- let ty = cx. typeck_results( ) . expr_ty( obj_expr) ;
164
+ let ty = cx. typeck_results( ) . expr_ty( obj_expr) . peel_refs ( ) ;
162
165
if match_type( cx, ty, & paths:: SOLANA_PROGRAM_ACCOUNT_INFO ) ;
163
166
then {
164
167
true
You can’t perform that action at this time.
0 commit comments