Skip to content

Commit f28c1fe

Browse files
committed
Make clippy happy.
1 parent 302d171 commit f28c1fe

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

clippy_lints/src/ptr.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,21 +213,18 @@ fn check_invalid_ptr_usage<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) -
213213
(&paths::PTR_WRITE_BYTES, 0),
214214
];
215215

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+
})?;
223220

224221
span_lint_and_sugg(
225222
cx,
226223
INVALID_NULL_PTR_USAGE,
227224
arg.span,
228225
"pointer must be non-null",
229226
"change this to",
230-
format!("core::ptr::NonNull::dangling().as_ptr()"),
227+
"core::ptr::NonNull::dangling().as_ptr()".to_string(),
231228
Applicability::MachineApplicable,
232229
);
233230

0 commit comments

Comments
 (0)