From 85c4883521d5839e3403b1eb310f5a219c193a31 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Mon, 21 Sep 2026 06:33:44 +0000 Subject: [PATCH] Remove dead code: 49 trait impls nothing uses, across 12 crates rustc's dead_code lint exempts trait impls, so the workspace lints never report an impl that no caller and no bound needs. A relink of the debug build with --gc-sections shows which impl methods the linker drops from every codegen unit. Each impl here has no live code in that link, and the workspace still compiles without it on all 12 targets, in the release profile, and with --tests. Also removes hash_array_list in src/css/generics.rs. Its only caller was the removed CssHash impl for ArrayList. --- src/ast/e.rs | 6 -- src/bun_alloc/baby_vec.rs | 38 -------- src/bun_alloc/lib.rs | 12 --- src/bun_core/atomic_cell.rs | 38 -------- src/bun_core/fmt.rs | 6 -- src/bun_core/output.rs | 15 --- src/bundler/Chunk.rs | 9 -- src/bundler/bundle_v2.rs | 14 --- src/collections/array_hash_map.rs | 12 --- src/css/generics.rs | 93 ------------------- src/css/media_query.rs | 7 -- src/css/properties/mod.rs | 18 ---- src/css/rules/supports.rs | 14 --- src/css/selectors/parser.rs | 38 -------- src/css/values/alpha.rs | 8 -- .../lockfile_json_stringify_for_debugging.rs | 6 -- src/install/resolution.rs | 7 -- src/install_types/resolver_hooks.rs | 18 ---- src/jsc/JSPropertyIterator.rs | 6 -- src/jsc/JSValue.rs | 22 ----- src/jsc/host_fn.rs | 6 -- src/react_compiler/hir/mod.rs | 6 -- src/runtime/bake/DevServer.rs | 5 - src/runtime/error.rs | 17 ---- src/tcc_sys/tcc.rs | 15 --- 25 files changed, 436 deletions(-) diff --git a/src/ast/e.rs b/src/ast/e.rs index 88edbc752911..520c12f6f077 100644 --- a/src/ast/e.rs +++ b/src/ast/e.rs @@ -695,12 +695,6 @@ impl Number { self.value } } -impl From for Number { - #[inline] - fn from(v: f64) -> Self { - Number::new(v) - } -} const DOUBLE_DIGIT: [&[u8]; 101] = [ b"0", b"1", b"2", b"3", b"4", b"5", b"6", b"7", b"8", b"9", b"10", b"11", b"12", b"13", b"14", diff --git a/src/bun_alloc/baby_vec.rs b/src/bun_alloc/baby_vec.rs index 7ae6935760dc..6f3b5e730918 100644 --- a/src/bun_alloc/baby_vec.rs +++ b/src/bun_alloc/baby_vec.rs @@ -360,31 +360,6 @@ impl<'a, T> Extend for BabyVec<'a, T> { } } -impl<'a, 'b, T: Copy> Extend<&'b T> for BabyVec<'a, T> { - #[inline] - fn extend>(&mut self, iter: I) { - for v in iter { - self.push(*v); - } - } -} - -impl<'a, 'b, T> IntoIterator for &'b BabyVec<'a, T> { - type Item = &'b T; - type IntoIter = slice::Iter<'b, T>; - #[inline] - fn into_iter(self) -> Self::IntoIter { - self.as_slice().iter() - } -} -impl<'a, 'b, T> IntoIterator for &'b mut BabyVec<'a, T> { - type Item = &'b mut T; - type IntoIter = slice::IterMut<'b, T>; - #[inline] - fn into_iter(self) -> Self::IntoIter { - self.as_mut_slice().iter_mut() - } -} impl<'a, T> IntoIterator for BabyVec<'a, T> { type Item = T; type IntoIter = IntoIter<'a, T>; @@ -452,16 +427,3 @@ impl<'a, T: fmt::Debug> fmt::Debug for BabyVec<'a, T> { self.as_slice().fmt(f) } } - -impl<'a, T> core::borrow::Borrow<[T]> for BabyVec<'a, T> { - #[inline] - fn borrow(&self) -> &[T] { - self.as_slice() - } -} -impl<'a, T> AsRef<[T]> for BabyVec<'a, T> { - #[inline] - fn as_ref(&self) -> &[T] { - self.as_slice() - } -} diff --git a/src/bun_alloc/lib.rs b/src/bun_alloc/lib.rs index 64a4a3b40677..7888ef351d0e 100644 --- a/src/bun_alloc/lib.rs +++ b/src/bun_alloc/lib.rs @@ -1847,18 +1847,6 @@ impl BSSAppendable for &[u8] { dst[..self.len()].copy_from_slice(self); } } -impl BSSAppendable for [&[u8]; N] { - fn total_len(&self) -> usize { - self.iter().map(|s| s.len()).sum() - } - fn copy_into(&self, dst: &mut [u8]) { - let mut remainder = dst; - for val in self { - remainder[..val.len()].copy_from_slice(val); - remainder = &mut remainder[val.len()..]; - } - } -} impl BSSAppendable for &[&[u8]] { fn total_len(&self) -> usize { self.iter().map(|s| s.len()).sum() diff --git a/src/bun_core/atomic_cell.rs b/src/bun_core/atomic_cell.rs index 92ef9071a860..d75bcb235c85 100644 --- a/src/bun_core/atomic_cell.rs +++ b/src/bun_core/atomic_cell.rs @@ -384,44 +384,6 @@ unsafe impl Atom for *mut U { } } -// SAFETY: same as `*mut U`; the cast goes through `*mut U`. -unsafe impl Atom for *const U { - #[inline] - unsafe fn _atomic_load(p: *mut Self, ord: Ordering) -> Self { - // SAFETY: `p` is `AtomicCell<*const U>::inner.get()`, 8-aligned via - // `_align`; `*const U` and `AtomicPtr` have identical layout. - unsafe { (*(p as *const AtomicPtr)).load(ord).cast_const() } - } - #[inline] - unsafe fn _atomic_store(p: *mut Self, v: Self, ord: Ordering) { - // SAFETY: `p` is 8-aligned and live; `*const U` and `AtomicPtr` - // have identical layout (see `_atomic_load`). - unsafe { (*(p as *const AtomicPtr)).store(v.cast_mut(), ord) } - } - #[inline] - unsafe fn _atomic_cas( - p: *mut Self, - cur: Self, - new: Self, - s: Ordering, - f: Ordering, - ) -> Result { - // SAFETY: `p` is 8-aligned and live; `*const U` and `AtomicPtr` - // have identical layout (see `_atomic_load`). - unsafe { - match (*(p as *const AtomicPtr)).compare_exchange( - cur.cast_mut(), - new.cast_mut(), - s, - f, - ) { - Ok(x) => Ok(x.cast_const()), - Err(x) => Err(x.cast_const()), - } - } - } -} - #[inline(always)] fn nn_to_raw(v: Option>) -> *mut U { v.map_or(core::ptr::null_mut(), |n| n.as_ptr()) diff --git a/src/bun_core/fmt.rs b/src/bun_core/fmt.rs index bdf26a693d2c..63195972f907 100644 --- a/src/bun_core/fmt.rs +++ b/src/bun_core/fmt.rs @@ -996,12 +996,6 @@ impl core::fmt::Display for InvalidCharacter { } } impl core::error::Error for InvalidCharacter {} -impl From for crate::CrateError { - #[inline] - fn from(_: InvalidCharacter) -> Self { - crate::CrateError::InvalidCharacter - } -} /// `WTF.parseDouble` — partial-match Latin-1 double parser. Returns `Ok` if /// any numeric prefix was consumed; `Err(InvalidCharacter)` on empty input or diff --git a/src/bun_core/output.rs b/src/bun_core/output.rs index 309a9c64533f..f536c80337d5 100644 --- a/src/bun_core/output.rs +++ b/src/bun_core/output.rs @@ -1781,21 +1781,6 @@ impl FmtTuple for fmt::Arguments<'_> { 1 } } -impl FmtTuple for &[T] { - fn write_nth(&self, idx: usize, f: &mut dyn fmt::Write) -> Result { - match self.get(idx) { - Some(v) => { - write!(f, "{}", v)?; - Ok(true) - } - None => Ok(false), - } - } - #[inline] - fn len(&self) -> usize { - (*self).len() - } -} impl FmtTuple for &[T; N] { fn write_nth(&self, idx: usize, f: &mut dyn fmt::Write) -> Result { match self.get(idx) { diff --git a/src/bundler/Chunk.rs b/src/bundler/Chunk.rs index 9c18d2b2ebfd..9163537dad08 100644 --- a/src/bundler/Chunk.rs +++ b/src/bundler/Chunk.rs @@ -192,15 +192,6 @@ impl CompileResultSlots { } } -impl core::ops::Index for CompileResultSlots { - type Output = CompileResult; - #[inline] - fn index(&self, i: usize) -> &CompileResult { - // SAFETY: reads happen only after the pool join; no concurrent writer. - unsafe { &*self.0[i].get() } - } -} - impl Default for Chunk { fn default() -> Self { Chunk { diff --git a/src/bundler/bundle_v2.rs b/src/bundler/bundle_v2.rs index 37994f596d5c..7bcb90da74a5 100644 --- a/src/bundler/bundle_v2.rs +++ b/src/bundler/bundle_v2.rs @@ -7700,20 +7700,6 @@ pub mod bv2_impl { } } impl Eq for StableRef {} - impl Ord for StableRef { - #[inline] - fn cmp(&self, other: &Self) -> core::cmp::Ordering { - let (a_idx, a_ref) = (self.stable_source_index, self.r#ref); - let (b_idx, b_ref) = (other.stable_source_index, other.r#ref); - (a_idx, a_ref.inner_index()).cmp(&(b_idx, b_ref.inner_index())) - } - } - impl PartialOrd for StableRef { - #[inline] - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } - } #[derive(Clone, Copy, Default, PartialEq, Eq)] pub struct ImportTracker { diff --git a/src/collections/array_hash_map.rs b/src/collections/array_hash_map.rs index 817e3f0a9bad..9b8f3cfb8c1c 100644 --- a/src/collections/array_hash_map.rs +++ b/src/collections/array_hash_map.rs @@ -1234,18 +1234,6 @@ impl ArrayHashMap { } } -impl ArrayHashMapExt for ArrayHashMap { - type Key = K; - type Value = V; - type Iterator<'a> - = Iter<'a, K, V> - where - Self: 'a; - fn iterator(&mut self) -> Iter<'_, K, V> { - ArrayHashMap::iterator(self) - } -} - // ────────────────────────────────────────────────────────────────────────── // StringArrayHashMap — `[]const u8`-keyed wrapper // ────────────────────────────────────────────────────────────────────────── diff --git a/src/css/generics.rs b/src/css/generics.rs index 1298f21d41fc..d119f723060b 100644 --- a/src/css/generics.rs +++ b/src/css/generics.rs @@ -79,13 +79,6 @@ impl<'bump, T: DeepClone<'bump>> DeepClone<'bump> for Option { } } -impl<'bump, T: DeepClone<'bump>> DeepClone<'bump> for &'bump T { - #[inline] - fn deep_clone(&self, bump: &'bump Arena) -> Self { - bump.alloc((**self).deep_clone(bump)) - } -} - impl<'bump, T: DeepClone<'bump>> DeepClone<'bump> for &'bump [T] { fn deep_clone(&self, bump: &'bump Arena) -> Self { // PERF: element-wise deep_clone — profile if hot @@ -313,19 +306,6 @@ impl CssEql for str { } } -impl CssEql for [T; N] { - #[inline] - fn eql(&self, other: &Self) -> bool { - // Element-wise eql (length is `N` on both sides by type). - for (a, b) in self.iter().zip(other.iter()) { - if !a.eql(b) { - return false; - } - } - true - } -} - impl CssEql for Box { #[inline] fn eql(&self, other: &Self) -> bool { @@ -890,23 +870,12 @@ pub fn implement_hash(this: &T, hasher: &mut Wyhash) { this.hash(hasher) } -fn hash_array_list(this: &ArrayList<'_, V>, hasher: &mut Wyhash) { - for item in this.iter() { - item.hash(hasher); - } -} - fn hash_baby_list(this: &Vec, hasher: &mut Wyhash) { for item in this.slice_const() { item.hash(hasher); } } -impl CssHash for () { - #[inline] - fn hash(&self, _hasher: &mut Wyhash) {} -} - impl CssHash for Option { #[inline] fn hash(&self, hasher: &mut Wyhash) { @@ -934,27 +903,6 @@ impl CssHash for [T] { } } -impl CssHash for [T; N] { - fn hash(&self, hasher: &mut Wyhash) { - // Feed the raw bytes - // of the `usize` length into the hasher. `bun_core::write_any_to_hasher` exists - // but is `H: Hasher`-generic and routes through `Hasher::write`, which - // for `Wyhash11` calls `update` — so inlining the `usize` byte-feed - // here is byte-identical and avoids the trait hop. - hasher.update(&self.len().to_ne_bytes()); - for item in self { - item.hash(hasher); - } - } -} - -impl<'bump, T: CssHash> CssHash for ArrayList<'bump, T> { - #[inline] - fn hash(&self, hasher: &mut Wyhash) { - hash_array_list(self, hasher) - } -} - impl CssHash for Vec { #[inline] fn hash(&self, hasher: &mut Wyhash) { @@ -1019,15 +967,6 @@ impl CssHash for VendorPrefix { } } -impl CssHash for bun_ast::Loc { - #[inline] - fn hash(&self, hasher: &mut Wyhash) { - // Providing a structural hash here lets `#[derive(CssHash)]` types - // include a `loc` field without `#[css(skip)]` if they want. - hasher.update(&self.start.to_ne_bytes()); - } -} - // ─────────────────────────────────────────────────────────────────────────────── // slice / isCompatible // ─────────────────────────────────────────────────────────────────────────────── @@ -1119,13 +1058,6 @@ impl IsCompatible for [T] { } } -impl IsCompatible for [T; N] { - #[inline] - fn is_compatible(&self, browsers: &crate::targets::Browsers) -> bool { - self.as_slice().is_compatible(browsers) - } -} - impl IsCompatible for Vec { #[inline] fn is_compatible(&self, browsers: &crate::targets::Browsers) -> bool { @@ -1351,13 +1283,6 @@ impl ToCss for Option { } } -impl<'bump, T: ToCss> ToCss for ArrayList<'bump, T> { - #[inline] - fn to_css(&self, dest: &mut Printer) -> core::result::Result<(), PrintErr> { - css::to_css::from_list(self.as_slice(), dest) - } -} - impl ToCss for Vec { #[inline] fn to_css(&self, dest: &mut Printer) -> core::result::Result<(), PrintErr> { @@ -1398,24 +1323,6 @@ impl ToCss for CSSInteger { CSSIntegerFns::to_css(*self, dest) } } -impl ToCss for CustomIdent { - #[inline] - fn to_css(&self, dest: &mut Printer) -> core::result::Result<(), PrintErr> { - CustomIdentFns::to_css(self, dest) - } -} -impl ToCss for DashedIdent { - #[inline] - fn to_css(&self, dest: &mut Printer) -> core::result::Result<(), PrintErr> { - DashedIdentFns::to_css(self, dest) - } -} -impl ToCss for Ident { - #[inline] - fn to_css(&self, dest: &mut Printer) -> core::result::Result<(), PrintErr> { - IdentFns::to_css(self, dest) - } -} // ── leaf-type forwarding macros ────────────────────────────────────────────── // Every CSS leaf value type carries inherent `parse` / `to_css` (hand-written diff --git a/src/css/media_query.rs b/src/css/media_query.rs index 14704e488822..2d1295755348 100644 --- a/src/css/media_query.rs +++ b/src/css/media_query.rs @@ -680,13 +680,6 @@ impl MediaList { } } -impl crate::generic::ToCss for MediaList { - #[inline] - fn to_css(&self, dest: &mut Printer) -> core::result::Result<(), PrintErr> { - MediaList::to_css(self, dest) - } -} - impl MediaQuery { /// Returns whether the media query is guaranteed to always match. pub(crate) fn always_matches(&self) -> bool { diff --git a/src/css/properties/mod.rs b/src/css/properties/mod.rs index 14c12cb22eb7..bd52d6ac2429 100644 --- a/src/css/properties/mod.rs +++ b/src/css/properties/mod.rs @@ -198,15 +198,6 @@ mod generic_registrations { css_values::length::Length::parse(input) } } - impl crate::generics::ParseWithOptions for css_values::length::Length { - #[inline] - fn parse_with_options( - input: &mut crate::css_parser::Parser, - _o: &crate::css_parser::ParserOptions, - ) -> crate::css_parser::CssResult { - css_values::length::Length::parse(input) - } - } impl crate::generics::Parse for css_values::color::CssColor { #[inline] fn parse(input: &mut crate::css_parser::Parser) -> crate::css_parser::CssResult { @@ -297,15 +288,6 @@ mod generic_registrations { // `GenericBorder` covers Border / BorderTop / … / Outline. The // inherent impl block bounds `S` on the protocol traits; mirror here. - impl crate::generics::Parse for GenericBorder - where - GenericBorder: GenericBorderImpl, - { - #[inline] - fn parse(input: &mut crate::css_parser::Parser) -> crate::css_parser::CssResult { - ::parse(input) - } - } impl crate::generics::ParseWithOptions for GenericBorder where GenericBorder: GenericBorderImpl, diff --git a/src/css/rules/supports.rs b/src/css/rules/supports.rs index 738d87738e68..01f6d3cb187d 100644 --- a/src/css/rules/supports.rs +++ b/src/css/rules/supports.rs @@ -115,13 +115,6 @@ impl SupportsCondition { } } -impl crate::generics::CssEql for SupportsCondition { - #[inline] - fn eql(&self, other: &Self) -> bool { - SupportsCondition::eql(self, other) - } -} - impl SupportsCondition { fn needs_parens(&self, parent: &SupportsCondition) -> bool { match self { @@ -224,13 +217,6 @@ impl SupportsCondition { } } -impl css::generic::ToCss for SupportsCondition { - #[inline] - fn to_css(&self, dest: &mut Printer) -> core::result::Result<(), PrintErr> { - SupportsCondition::to_css(self, dest) - } -} - // ─── parse bodies ───────────────────────────────────────────────────────── impl SupportsCondition { pub fn parse(input: &mut css::Parser) -> css::Result { diff --git a/src/css/selectors/parser.rs b/src/css/selectors/parser.rs index e2e26f4b5e3c..5e8df3665529 100644 --- a/src/css/selectors/parser.rs +++ b/src/css/selectors/parser.rs @@ -1586,18 +1586,6 @@ impl Default for GenericSelectorList { } } -impl Default for GenericSelector { - fn default() -> Self { - Self { - specificity_and_flags: SpecificityAndFlags { - specificity: 0, - flags: SelectorFlags::empty(), - }, - components: Vec::new_in(ArenaPtr::global()), - } - } -} - impl GenericSelectorList { /// Consume `self.v` and return a heap slice — used by `:is()`/`:where()`/ /// `:has()`/`:not()`/`:nth-*(.. of ..)` which store `Box<[Selector]>` to @@ -1779,19 +1767,6 @@ impl GenericSelectorList { } } -impl CssEql for GenericSelectorList { - #[inline] - fn eql(&self, other: &Self) -> bool { - self.eql(other) - } -} -impl CssHash for GenericSelectorList { - #[inline] - fn hash(&self, hasher: &mut Wyhash) { - self.hash(hasher) - } -} - // ───────────────────────────────────────────────────────────────────────────── // GenericSelector // ───────────────────────────────────────────────────────────────────────────── @@ -2405,19 +2380,6 @@ impl GenericComponent { } } -impl CssEql for GenericComponent { - #[inline] - fn eql(&self, other: &Self) -> bool { - self.eql(other) - } -} -impl CssHash for GenericComponent { - #[inline] - fn hash(&self, hasher: &mut Wyhash) { - self.hash(hasher) - } -} - impl fmt::Display for GenericComponent { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // A few variants get detail, the rest print diff --git a/src/css/values/alpha.rs b/src/css/values/alpha.rs index 2249b00eb45d..c2b98e2edb36 100644 --- a/src/css/values/alpha.rs +++ b/src/css/values/alpha.rs @@ -25,11 +25,3 @@ impl AlphaValue { CSSNumberFns::to_css(self.v, dest) } } - -impl crate::generics::CssHash for AlphaValue { - /// Field-wise: hash the single `f32` payload. - #[inline] - fn hash(&self, hasher: &mut crate::generics::Wyhash) { - crate::generics::CssHash::hash(&self.v, hasher); - } -} diff --git a/src/install/lockfile/lockfile_json_stringify_for_debugging.rs b/src/install/lockfile/lockfile_json_stringify_for_debugging.rs index 96a54a2e402a..f90d709ad96d 100644 --- a/src/install/lockfile/lockfile_json_stringify_for_debugging.rs +++ b/src/install/lockfile/lockfile_json_stringify_for_debugging.rs @@ -596,12 +596,6 @@ impl JsonScalar for &[u8] { encode_json_string(self, out); } } -impl JsonScalar for &[u8; N] { - #[inline] - fn write_json(&self, out: &mut Vec, opts: WriteStreamOptions) { - self.as_slice().write_json(out, opts); - } -} /// Quote + escape the minimal RFC-8259 set (`"`, `\`, U+0000..U+001F). Input is /// treated as already-valid UTF-8/WTF-8; the lockfile string buffer never diff --git a/src/install/resolution.rs b/src/install/resolution.rs index f6b89e01bb2f..5b3ae4ec675e 100644 --- a/src/install/resolution.rs +++ b/src/install/resolution.rs @@ -963,13 +963,6 @@ fn value_init(field: TaggedValue) -> Value Self { - Tag::Uninitialized - } -} - #[allow(non_upper_case_globals)] impl Tag { pub(crate) const Uninitialized: Tag = Tag(0); diff --git a/src/install_types/resolver_hooks.rs b/src/install_types/resolver_hooks.rs index 4a528a15776f..c74c47674d5b 100644 --- a/src/install_types/resolver_hooks.rs +++ b/src/install_types/resolver_hooks.rs @@ -1146,13 +1146,6 @@ pub union ResolutionValue { pub single_file_module: SemverString, } -impl Default for ResolutionValue { - #[inline] - fn default() -> Self { - ResolutionValue { uninitialized: () } - } -} - /// Layout is `{ tag: u8, _pad: [7]u8, value: Value }` so the on-disk lockfile /// encoding stays byte-compatible. #[repr(C)] @@ -1163,17 +1156,6 @@ pub struct Resolution { pub value: ResolutionValue, } -impl Default for Resolution { - #[inline] - fn default() -> Self { - Self { - tag: ResolutionTag::Uninitialized, - _padding: [0; 7], - value: ResolutionValue { uninitialized: () }, - } - } -} - // ─── PreinstallState / Features / misc ──────────────────────────────────── #[repr(u8)] diff --git a/src/jsc/JSPropertyIterator.rs b/src/jsc/JSPropertyIterator.rs index 5053b60f0086..b6c6ad38faff 100644 --- a/src/jsc/JSPropertyIterator.rs +++ b/src/jsc/JSPropertyIterator.rs @@ -80,12 +80,6 @@ impl IntoIterObject for *mut JSObject { self } } -impl IntoIterObject for *const JSObject { - #[inline] - fn into_iter_object(self) -> *mut JSObject { - self.cast_mut() - } -} impl IntoIterObject for NonNull { #[inline] fn into_iter_object(self) -> *mut JSObject { diff --git a/src/jsc/JSValue.rs b/src/jsc/JSValue.rs index 3a4ce3566e28..1eb5cfd82bfa 100644 --- a/src/jsc/JSValue.rs +++ b/src/jsc/JSValue.rs @@ -1858,39 +1858,17 @@ impl FromAny for &[u16] { } } -impl FromAny for () { - #[inline] - fn into_js_value(self, _global: &JSGlobalObject) -> JsResult { - Ok(JSValue::UNDEFINED) - } -} impl FromAny for &[u8] { #[inline] fn into_js_value(self, global: &JSGlobalObject) -> JsResult { bun_string_jsc::create_utf8_for_js(global, self) } } -impl FromAny for &str { - #[inline] - fn into_js_value(self, global: &JSGlobalObject) -> JsResult { - bun_string_jsc::create_utf8_for_js(global, self.as_bytes()) - } -} impl FromAny for Box<[bun_core::String]> { fn into_js_value(self, global: &JSGlobalObject) -> JsResult { bun_string_jsc::to_js_array(global, &self) } } -impl FromAny for Option { - /// `None` → `undefined`. - #[inline] - fn into_js_value(self, global: &JSGlobalObject) -> JsResult { - match self { - Some(v) => v.into_js_value(global), - None => Ok(JSValue::UNDEFINED), - } - } -} /// Dispatch trait for [`JSValue::put`]'s key parameter: routes /// `EncodedSlice`/`String`/byte-slice keys to the matching FFI. diff --git a/src/jsc/host_fn.rs b/src/jsc/host_fn.rs index b576c8cf0c6c..77633df2ae3c 100644 --- a/src/jsc/host_fn.rs +++ b/src/jsc/host_fn.rs @@ -274,12 +274,6 @@ impl IntoHostSetterReturn for JsResult { pub trait IntoHostConstructReturn { fn into_host_construct_return(self) -> JsResult<*mut c_void>; } -impl IntoHostConstructReturn for *mut T { - #[inline] - fn into_host_construct_return(self) -> JsResult<*mut c_void> { - Ok(self.cast()) - } -} impl IntoHostConstructReturn for Box { #[inline] fn into_host_construct_return(self) -> JsResult<*mut c_void> { diff --git a/src/react_compiler/hir/mod.rs b/src/react_compiler/hir/mod.rs index 6f79a5f17777..4583ceeb7463 100644 --- a/src/react_compiler/hir/mod.rs +++ b/src/react_compiler/hir/mod.rs @@ -156,12 +156,6 @@ impl FloatValue { } } -impl From for f64 { - fn from(value: FloatValue) -> Self { - value.value() - } -} - impl PartialEq for FloatValue { fn eq(&self, other: &Self) -> bool { self.0 == other.0 diff --git a/src/runtime/bake/DevServer.rs b/src/runtime/bake/DevServer.rs index a765e21ba6cb..88dbc1ba753f 100644 --- a/src/runtime/bake/DevServer.rs +++ b/src/runtime/bake/DevServer.rs @@ -5133,11 +5133,6 @@ pub(super) enum OpaqueFileIdOrOptional { Id(OpaqueFileId), Optional(framework_router::OpaqueFileIdOptional), } -impl From for OpaqueFileIdOrOptional { - fn from(v: OpaqueFileId) -> Self { - Self::Id(v) - } -} impl From for OpaqueFileIdOrOptional { fn from(v: framework_router::OpaqueFileIdOptional) -> Self { Self::Optional(v) diff --git a/src/runtime/error.rs b/src/runtime/error.rs index a7b1bd163ff9..5947497aaafa 100644 --- a/src/runtime/error.rs +++ b/src/runtime/error.rs @@ -330,23 +330,6 @@ impl From for bun_jsc::JsError { } } -impl From for bun_jsc::CrateError { - #[inline] - fn from(e: Error) -> Self { - match e { - Error::Sys(s) => Self::Sys(s), - Error::Alloc(a) => Self::Alloc(a), - Error::Core(c) => Self::Core(c), - Error::Resolver(r) => Self::Resolver(r), - Error::Bundler(b) => Self::Bundler(b), - Error::Install(i) => Self::Install(i), - Error::Jsc(j) => j, - Error::JSError | Error::Js(_) => Self::JSError, - _ => Self::Core(bun_core::Error::Unexpected), - } - } -} - impl From for bun_uws_sys::Error { #[inline] fn from(e: Error) -> Self { diff --git a/src/tcc_sys/tcc.rs b/src/tcc_sys/tcc.rs index 0a95ffe74e7b..94882c3cf491 100644 --- a/src/tcc_sys/tcc.rs +++ b/src/tcc_sys/tcc.rs @@ -140,21 +140,6 @@ pub struct Config { pub err: ConfigErr, } -impl Default for Config -where - ConfigErr: Default, -{ - fn default() -> Self { - // `err.handler` has no default, so this Default impl exists only for - // `ErrCtx` types whose `ConfigErr` provides a handler default. - Self { - options: None, - output_type: OutputFormat::Memory, - err: Default::default(), - } - } -} - impl State { /// Create a new TCC compilation context pub(crate) fn new() -> Result, bun_alloc::AllocError> {