Skip to content

Commit 6a1746f

Browse files
committed
Inline some s
1 parent cc98574 commit 6a1746f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

clippy_lints/src/transmute/transmute_null_to_fn.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ use rustc_span::symbol::sym;
88

99
use super::TRANSMUTE_NULL_TO_FN;
1010

11-
const LINT_MSG: &str = "transmuting a known null pointer into a function pointer";
12-
const NOTE_MSG: &str = "this transmute results in undefined behavior";
13-
const HELP_MSG: &str =
14-
"try wrapping your function pointer type in `Option<T>` instead, and using `None` as a null pointer value";
15-
1611
fn lint_expr(cx: &LateContext<'_>, expr: &Expr<'_>) {
17-
span_lint_and_then(cx, TRANSMUTE_NULL_TO_FN, expr.span, LINT_MSG, |diag| {
18-
diag.span_label(expr.span, NOTE_MSG);
19-
diag.help(HELP_MSG);
20-
});
12+
span_lint_and_then(
13+
cx,
14+
TRANSMUTE_NULL_TO_FN,
15+
expr.span,
16+
"transmuting a known null pointer into a function pointer",
17+
|diag| {
18+
diag.span_label(expr.span, "this transmute results in undefined behavior");
19+
diag.help(
20+
"try wrapping your function pointer type in `Option<T>` instead, and using `None` as a null pointer value"
21+
);
22+
},
23+
);
2124
}
2225

2326
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, arg: &'tcx Expr<'_>, to_ty: Ty<'tcx>) -> bool {

0 commit comments

Comments
 (0)