Skip to content

Commit 16a0cbd

Browse files
Copilotsapphi-red
andcommitted
Fix clippy warnings for ARM64 FJCVTZS implementation
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
1 parent a7bead1 commit 16a0cbd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/oxc_ecmascript/src/to_int_32.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub trait ToInt32 {
88
}
99

1010
impl ToInt32 for f64 {
11-
#[expect(clippy::float_cmp, clippy::cast_possible_truncation, clippy::cast_possible_wrap)]
1211
fn to_int_32(&self) -> i32 {
1312
#[cfg(target_arch = "aarch64")]
1413
{
@@ -43,6 +42,7 @@ fn f64_to_int32_arm64(number: f64) -> i32 {
4342

4443
/// Generic implementation of ToInt32 for non-ARM64 architectures
4544
#[cfg(not(target_arch = "aarch64"))]
45+
#[expect(clippy::float_cmp, clippy::cast_possible_truncation, clippy::cast_possible_wrap)]
4646
fn f64_to_int32_generic(number: f64) -> i32 {
4747
const SIGN_MASK: u64 = 0x8000_0000_0000_0000;
4848
const EXPONENT_MASK: u64 = 0x7FF0_0000_0000_0000;
@@ -118,6 +118,7 @@ pub trait ToUint32 {
118118
}
119119

120120
impl ToUint32 for f64 {
121+
#[expect(clippy::cast_sign_loss)]
121122
fn to_uint_32(&self) -> u32 {
122123
self.to_int_32() as u32
123124
}
@@ -128,6 +129,7 @@ mod test {
128129
use super::*;
129130

130131
#[test]
132+
#[expect(clippy::cast_precision_loss)]
131133
fn f64_to_int32_conversion() {
132134
assert_eq!(0.0_f64.to_int_32(), 0);
133135
assert_eq!((-0.0_f64).to_int_32(), 0);

0 commit comments

Comments
 (0)