Convert two missed places

This commit is contained in:
Bastian Kersting 2025-01-24 15:13:37 +00:00
parent 432ff5e559
commit 854948a4ab
2 changed files with 2 additions and 2 deletions

View file

@ -53,7 +53,7 @@ fn expr_as_cast_to_usize<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>
// If the given expression is a cast to a `*const` pointer, return the lhs of the cast
// E.g., `foo as *const _` returns `foo`.
fn expr_as_cast_to_raw_pointer<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
if cx.typeck_results().expr_ty(cast_expr).is_unsafe_ptr() {
if cx.typeck_results().expr_ty(cast_expr).is_raw_ptr() {
if let ExprKind::Cast(expr, _) = cast_expr.kind {
return Some(expr);
}

View file

@ -76,7 +76,7 @@ impl LateLintPass<'_> for SwapPtrToRef {
fn is_ptr_to_ref(cx: &LateContext<'_>, e: &Expr<'_>, ctxt: SyntaxContext) -> (bool, Option<Span>) {
if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mut, borrowed_expr) = e.kind
&& let ExprKind::Unary(UnOp::Deref, derefed_expr) = borrowed_expr.kind
&& cx.typeck_results().expr_ty(derefed_expr).is_unsafe_ptr()
&& cx.typeck_results().expr_ty(derefed_expr).is_raw_ptr()
{
(
true,