Skip to content

Commit 40bed0d

Browse files
committed
Replace transmute with const_ptr::cast
This silences a new clippy lint about using transmute without explicit generic parameters. Rather than adding the explicit parameters, I figured it's better to do without the `transmute` altogether.
1 parent 6d9766d commit 40bed0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/defaults/lexer.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,11 @@ unsafe fn find_identifier_end_avx2(input: &str, mut offset: usize) -> usize {
569569
// SAFETY: requires that a 32-byte load from `input.as_ptr() + offset` does not touch uninitialised memory.
570570
// The above length check guarantees this.
571571
let ident_mask = unsafe {
572-
let chunk = _mm256_loadu_si256(core::mem::transmute(input.as_ptr().add(offset)));
572+
let chunk = _mm256_loadu_si256(
573+
// the `loadu` variant of this intrinsic doesn't require aligned addresses
574+
#[allow(clippy::cast_ptr_alignment)]
575+
input.as_ptr().add(offset).cast(),
576+
);
573577
if any_non_ascii(chunk) {
574578
break;
575579
};

0 commit comments

Comments
 (0)