Add instructions on what to do in case casts other than to integers is ever working for function pointers
This commit is contained in:
parent
d05f297164
commit
66b4e93ba8
1 changed files with 3 additions and 0 deletions
|
|
@ -39,6 +39,9 @@ impl<'tcx> LateLintPass<'tcx> for FunctionCastsAsInteger {
|
|||
let hir::ExprKind::Cast(cast_from_expr, cast_to_expr) = expr.kind else { return };
|
||||
let cast_to_ty = cx.typeck_results().expr_ty(expr);
|
||||
// Casting to a function (pointer?), so all good.
|
||||
//
|
||||
// Normally, only casts to integers is possible, but if it ever changed, this condition
|
||||
// will likely need to be updated.
|
||||
if matches!(cast_to_ty.kind(), ty::FnDef(..) | ty::FnPtr(..) | ty::RawPtr(..)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue