Skip to content

Commit 145e00c

Browse files
Copilotsapphi-red
andcommitted
Remove ToUint32 trait and implementation as requested in feedback
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
1 parent 16a0cbd commit 145e00c

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

crates/oxc_ecmascript/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub use self::{
4747
string_to_number::StringToNumber,
4848
to_big_int::ToBigInt,
4949
to_boolean::ToBoolean,
50-
to_int_32::{ToInt32, ToUint32},
50+
to_int_32::ToInt32,
5151
to_integer_index::ToIntegerIndex,
5252
to_number::ToNumber,
5353
to_primitive::ToPrimitive,

crates/oxc_ecmascript/src/to_int_32.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,6 @@ fn f64_to_int32_generic(number: f64) -> i32 {
110110
(sign(number) * (bits as i64)) as i32
111111
}
112112

113-
/// Converts a 64-bit floating point number to an `u32` according to the [`ToUint32`][ToUint32] algorithm.
114-
///
115-
/// [ToUint32]: https://tc39.es/ecma262/#sec-touint32
116-
pub trait ToUint32 {
117-
fn to_uint_32(&self) -> u32;
118-
}
119-
120-
impl ToUint32 for f64 {
121-
#[expect(clippy::cast_sign_loss)]
122-
fn to_uint_32(&self) -> u32 {
123-
self.to_int_32() as u32
124-
}
125-
}
126-
127113
#[cfg(test)]
128114
mod test {
129115
use super::*;
@@ -143,11 +129,4 @@ mod test {
143129
assert_eq!((9007199254740992.0_f64).to_int_32(), 0); // 2^53
144130
assert_eq!((-9007199254740992.0_f64).to_int_32(), 0); // -2^53
145131
}
146-
147-
#[test]
148-
fn f64_to_uint32_conversion() {
149-
assert_eq!(0.0_f64.to_uint_32(), 0);
150-
assert_eq!((-1.0_f64).to_uint_32(), 4294967295); // -1 as u32 is 2^32 - 1
151-
assert_eq!(f64::NAN.to_uint_32(), 0);
152-
}
153132
}

0 commit comments

Comments
 (0)