Skip to content

Commit 30f284d

Browse files
remove explicit deref of AbiAlign for most methods
Much of the compiler calls functions on Align projected from AbiAlign. AbiAlign impls Deref to its inner Align, so we can simplify these away. Also, it will minimize disruption when AbiAlign is removed. For now, preserve usages that might resolve to PartialOrd or PartialEq, as those have odd inference.
1 parent 7c4cde8 commit 30f284d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clippy_lints/src/casts/cast_ptr_alignment.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ fn lint_cast_ptr_alignment<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, cast_f
4343
expr.span,
4444
format!(
4545
"casting from `{cast_from}` to a more-strictly-aligned pointer (`{cast_to}`) ({} < {} bytes)",
46-
from_layout.align.abi.bytes(),
47-
to_layout.align.abi.bytes(),
46+
from_layout.align.bytes(),
47+
to_layout.align.bytes(),
4848
),
4949
);
5050
}

clippy_lints/src/casts/manual_dangling_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn is_literal_aligned(cx: &LateContext<'_>, lit: &Spanned<LitKind>, to: &Ty<'_>)
7272
cx.tcx
7373
.layout_of(cx.typing_env().as_query_input(to_mid_ty))
7474
.is_ok_and(|layout| {
75-
let align = u128::from(layout.align.abi.bytes());
75+
let align = u128::from(layout.align.bytes());
7676
u128::from(val) <= align
7777
})
7878
}

0 commit comments

Comments
 (0)