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
2 changes: 1 addition & 1 deletion crates/oxc_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ doctest = true
[dependencies]
oxc_allocator = { workspace = true }
oxc_ast = { workspace = true }
oxc_data_structures = { workspace = true, features = ["code_buffer", "slice_iter_ext", "stack"] }
oxc_data_structures = { workspace = true, features = ["code_buffer", "slice_iter", "stack"] }
oxc_index = { workspace = true }
oxc_semantic = { workspace = true }
oxc_sourcemap = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_codegen/src/sourcemap_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::path::Path;

use nonmax::NonMaxU32;

use oxc_data_structures::slice_iter_ext::SliceIterExt;
use oxc_data_structures::slice_iter::SliceIter;
use oxc_index::{Idx, IndexVec};
use oxc_span::Span;
use oxc_syntax::identifier::{LS, PS};
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_codegen/src/str.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::slice;

use oxc_ast::ast::StringLiteral;
use oxc_data_structures::{assert_unchecked, slice_iter_ext::SliceIterExt};
use oxc_data_structures::{assert_unchecked, slice_iter::SliceIter};
use oxc_syntax::identifier::{LS, NBSP, PS};

use crate::Codegen;
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ ropey = { workspace = true, optional = true }

[features]
default = []
all = ["assert_unchecked", "code_buffer", "inline_string", "rope", "slice_iter_ext", "stack"]
all = ["assert_unchecked", "code_buffer", "inline_string", "rope", "slice_iter", "stack"]
assert_unchecked = []
code_buffer = ["assert_unchecked"]
inline_string = ["assert_unchecked"]
rope = ["dep:ropey"]
slice_iter_ext = ["assert_unchecked"]
slice_iter = ["assert_unchecked"]
stack = []
6 changes: 3 additions & 3 deletions crates/oxc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ pub mod code_buffer;
#[cfg(feature = "inline_string")]
pub mod inline_string;

#[cfg(feature = "slice_iter_ext")]
pub mod slice_iter_ext;

#[cfg(feature = "rope")]
pub mod rope;

#[cfg(feature = "slice_iter")]
pub mod slice_iter;

#[cfg(feature = "stack")]
pub mod stack;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Provides additional methods to inspect and advance iterators.
//!
//! See [`SliceIterExt`] and [`SliceIterMutExt`].
//! See [`SliceIter`] and [`SliceIterMut`].

// All methods boil down to just a few instructions.
// https://godbolt.org/z/KrsTz9478
Expand All @@ -17,7 +17,7 @@ use crate::assert_unchecked;

/// Extension trait for slice iterators.
#[expect(private_bounds)]
pub trait SliceIterExt<'slice, T>: ExactSizeIterator + AsRef<[T]> + Sealed {
pub trait SliceIter<'slice, T>: ExactSizeIterator + AsRef<[T]> + Sealed {
/// The type returned by `peek` method.
type Peeked<'iter>
where
Expand Down Expand Up @@ -83,7 +83,7 @@ pub trait SliceIterExt<'slice, T>: ExactSizeIterator + AsRef<[T]> + Sealed {
}
}

impl<'slice, T: 'slice> SliceIterExt<'slice, T> for Iter<'slice, T> {
impl<'slice, T: 'slice> SliceIter<'slice, T> for Iter<'slice, T> {
// `peek` method returns a reference which borrows the slice, not the iterator
type Peeked<'iter>
= &'slice T
Expand Down Expand Up @@ -141,7 +141,7 @@ impl<'slice, T: 'slice> SliceIterExt<'slice, T> for Iter<'slice, T> {
}
}

impl<'slice, T: 'slice> SliceIterExt<'slice, T> for IterMut<'slice, T> {
impl<'slice, T: 'slice> SliceIter<'slice, T> for IterMut<'slice, T> {
// `peek` method returns a reference which borrows the iterator
type Peeked<'iter>
= &'iter T
Expand Down Expand Up @@ -207,12 +207,12 @@ impl<'slice, T: 'slice> SliceIterExt<'slice, T> for IterMut<'slice, T> {
}

/// Extension trait for [`IterMut`] slice iterator.
pub trait SliceIterMutExt<'slice, T>: SliceIterExt<'slice, T> {
pub trait SliceIterMut<'slice, T>: SliceIter<'slice, T> {
/// Get the remaining items in the iterator as a mutable slice.
fn as_mut_slice(&mut self) -> &mut [T];
}

impl<'slice, T: 'slice> SliceIterMutExt<'slice, T> for IterMut<'slice, T> {
impl<'slice, T: 'slice> SliceIterMut<'slice, T> for IterMut<'slice, T> {
/// Get the remaining items in the iterator as a mutable slice.
///
/// This method is present in standard library, but requires nightly Rust.
Expand All @@ -234,8 +234,8 @@ impl<'slice, T: 'slice> SliceIterMutExt<'slice, T> for IterMut<'slice, T> {
}

/// Private trait.
/// [`SliceIterExt`] extends `Sealed`, which prevents code outside this file implementing
/// `SliceIterExt` on other types.
/// [`SliceIter`] extends `Sealed`, which prevents code outside this file implementing
/// `SliceIter` on other types.
trait Sealed {}

impl<'slice, T: 'slice> Sealed for Iter<'slice, T> {}
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_estree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ workspace = true
doctest = false

[dependencies]
oxc_data_structures = { workspace = true, features = ["code_buffer", "slice_iter_ext", "stack"], optional = true }
oxc_data_structures = { workspace = true, features = ["code_buffer", "slice_iter", "stack"], optional = true }

dragonbox_ecma = { workspace = true, optional = true }
itoa = { workspace = true, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_estree/src/serialize/strings.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{num::NonZeroU64, slice};

use oxc_data_structures::{code_buffer::CodeBuffer, slice_iter_ext::SliceIterExt};
use oxc_data_structures::{code_buffer::CodeBuffer, slice_iter::SliceIter};

use super::{ESTree, Serializer};

Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_transformer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ oxc-browserslist = { workspace = true }
oxc_allocator = { workspace = true }
oxc_ast = { workspace = true }
oxc_ast_visit = { workspace = true }
oxc_data_structures = { workspace = true, features = ["assert_unchecked", "inline_string", "rope", "slice_iter_ext", "stack"] }
oxc_data_structures = { workspace = true, features = ["assert_unchecked", "inline_string", "rope", "slice_iter", "stack"] }
oxc_diagnostics = { workspace = true }
oxc_ecmascript = { workspace = true }
oxc_parser = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_transformer/src/plugins/styled_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ use serde::Deserialize;

use oxc_allocator::{TakeIn, Vec as ArenaVec};
use oxc_ast::{AstBuilder, NONE, ast::*};
use oxc_data_structures::{inline_string::InlineString, slice_iter_ext::SliceIterExt};
use oxc_data_structures::{inline_string::InlineString, slice_iter::SliceIter};
use oxc_semantic::SymbolId;
use oxc_span::SPAN;
use oxc_traverse::{Ancestor, Traverse};
Expand Down
Loading