File tree 1 file changed +5
-8
lines changed 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -213,21 +213,18 @@ fn check_invalid_ptr_usage<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -
213
213
( & paths:: PTR_WRITE_BYTES , 0 ) ,
214
214
] ;
215
215
216
- let arg = INVALID_NULL_PTR_USAGE_TABLE
217
- . iter ( )
218
- . filter_map ( |( fn_name, arg_idx) | {
219
- let args = match_function_call ( cx, expr, fn_name) ?;
220
- args. iter ( ) . nth ( * arg_idx) . filter ( |arg| is_null_path ( arg) )
221
- } )
222
- . next ( ) ?;
216
+ let arg = INVALID_NULL_PTR_USAGE_TABLE . iter ( ) . find_map ( |( fn_name, arg_idx) | {
217
+ let args = match_function_call ( cx, expr, fn_name) ?;
218
+ args. get ( * arg_idx) . filter ( |arg| is_null_path ( arg) )
219
+ } ) ?;
223
220
224
221
span_lint_and_sugg (
225
222
cx,
226
223
INVALID_NULL_PTR_USAGE ,
227
224
arg. span ,
228
225
"pointer must be non-null" ,
229
226
"change this to" ,
230
- format ! ( "core::ptr::NonNull::dangling().as_ptr()" ) ,
227
+ "core::ptr::NonNull::dangling().as_ptr()" . to_string ( ) ,
231
228
Applicability :: MachineApplicable ,
232
229
) ;
233
230
You can’t perform that action at this time.
0 commit comments