Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/ast/e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,12 +695,6 @@ impl Number {
self.value
}
}
impl From<f64> 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",
Expand Down
38 changes: 0 additions & 38 deletions src/bun_alloc/baby_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,31 +360,6 @@ impl<'a, T> Extend<T> for BabyVec<'a, T> {
}
}

impl<'a, 'b, T: Copy> Extend<&'b T> for BabyVec<'a, T> {
#[inline]
fn extend<I: IntoIterator<Item = &'b T>>(&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>;
Expand Down Expand Up @@ -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()
}
}
12 changes: 0 additions & 12 deletions src/bun_alloc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1847,18 +1847,6 @@ impl BSSAppendable for &[u8] {
dst[..self.len()].copy_from_slice(self);
}
}
impl<const N: usize> 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()
Expand Down
38 changes: 0 additions & 38 deletions src/bun_core/atomic_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,44 +384,6 @@ unsafe impl<U> Atom for *mut U {
}
}

// SAFETY: same as `*mut U`; the cast goes through `*mut U`.
unsafe impl<U> 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<U>` have identical layout.
unsafe { (*(p as *const AtomicPtr<U>)).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<U>`
// have identical layout (see `_atomic_load`).
unsafe { (*(p as *const AtomicPtr<U>)).store(v.cast_mut(), ord) }
}
#[inline]
unsafe fn _atomic_cas(
p: *mut Self,
cur: Self,
new: Self,
s: Ordering,
f: Ordering,
) -> Result<Self, Self> {
// SAFETY: `p` is 8-aligned and live; `*const U` and `AtomicPtr<U>`
// have identical layout (see `_atomic_load`).
unsafe {
match (*(p as *const AtomicPtr<U>)).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<U>(v: Option<NonNull<U>>) -> *mut U {
v.map_or(core::ptr::null_mut(), |n| n.as_ptr())
Expand Down
6 changes: 0 additions & 6 deletions src/bun_core/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -996,12 +996,6 @@ impl core::fmt::Display for InvalidCharacter {
}
}
impl core::error::Error for InvalidCharacter {}
impl From<InvalidCharacter> 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
Expand Down
15 changes: 0 additions & 15 deletions src/bun_core/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1781,21 +1781,6 @@ impl FmtTuple for fmt::Arguments<'_> {
1
}
}
impl<T: fmt::Display> FmtTuple for &[T] {
fn write_nth(&self, idx: usize, f: &mut dyn fmt::Write) -> Result<bool, fmt::Error> {
match self.get(idx) {
Some(v) => {
write!(f, "{}", v)?;
Ok(true)
}
None => Ok(false),
}
}
#[inline]
fn len(&self) -> usize {
(*self).len()
}
}
impl<T: fmt::Display, const N: usize> FmtTuple for &[T; N] {
fn write_nth(&self, idx: usize, f: &mut dyn fmt::Write) -> Result<bool, fmt::Error> {
match self.get(idx) {
Expand Down
9 changes: 0 additions & 9 deletions src/bundler/Chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,6 @@ impl CompileResultSlots {
}
}

impl core::ops::Index<usize> 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 {
Expand Down
14 changes: 0 additions & 14 deletions src/bundler/bundle_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<core::cmp::Ordering> {
Some(self.cmp(other))
}
}

#[derive(Clone, Copy, Default, PartialEq, Eq)]
pub struct ImportTracker {
Expand Down
12 changes: 0 additions & 12 deletions src/collections/array_hash_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1234,18 +1234,6 @@ impl<K: Default, V: Default, C, A: MapAllocator> ArrayHashMap<K, V, C, A> {
}
}

impl<K, V, C, A: MapAllocator> ArrayHashMapExt for ArrayHashMap<K, V, C, A> {
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<V, C> — `[]const u8`-keyed wrapper
// ──────────────────────────────────────────────────────────────────────────
Expand Down
93 changes: 0 additions & 93 deletions src/css/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ impl<'bump, T: DeepClone<'bump>> DeepClone<'bump> for Option<T> {
}
}

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
Expand Down Expand Up @@ -313,19 +306,6 @@ impl CssEql for str {
}
}

impl<T: CssEql, const N: usize> 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<T: CssEql + ?Sized> CssEql for Box<T> {
#[inline]
fn eql(&self, other: &Self) -> bool {
Expand Down Expand Up @@ -890,23 +870,12 @@ pub fn implement_hash<T: CssHash>(this: &T, hasher: &mut Wyhash) {
this.hash(hasher)
}

fn hash_array_list<V: CssHash>(this: &ArrayList<'_, V>, hasher: &mut Wyhash) {
for item in this.iter() {
item.hash(hasher);
}
}

fn hash_baby_list<V: CssHash>(this: &Vec<V>, hasher: &mut Wyhash) {
for item in this.slice_const() {
item.hash(hasher);
}
}

impl CssHash for () {
#[inline]
fn hash(&self, _hasher: &mut Wyhash) {}
}

impl<T: CssHash> CssHash for Option<T> {
#[inline]
fn hash(&self, hasher: &mut Wyhash) {
Expand Down Expand Up @@ -934,27 +903,6 @@ impl<T: CssHash> CssHash for [T] {
}
}

impl<T: CssHash, const N: usize> 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<T: CssHash> CssHash for Vec<T> {
#[inline]
fn hash(&self, hasher: &mut Wyhash) {
Expand Down Expand Up @@ -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
// ───────────────────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -1119,13 +1058,6 @@ impl<T: IsCompatible> IsCompatible for [T] {
}
}

impl<T: IsCompatible, const N: usize> IsCompatible for [T; N] {
#[inline]
fn is_compatible(&self, browsers: &crate::targets::Browsers) -> bool {
self.as_slice().is_compatible(browsers)
}
}

impl<T: IsCompatible> IsCompatible for Vec<T> {
#[inline]
fn is_compatible(&self, browsers: &crate::targets::Browsers) -> bool {
Expand Down Expand Up @@ -1351,13 +1283,6 @@ impl<T: ToCss> ToCss for Option<T> {
}
}

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<T: ToCss> ToCss for Vec<T> {
#[inline]
fn to_css(&self, dest: &mut Printer) -> core::result::Result<(), PrintErr> {
Expand Down Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions src/css/media_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading
Loading