Commit graph

8 commits

Author SHA1 Message Date
DonIsaac
de22b81b83 docs(data-structures): enable lint warnings on missing docs, and add missing doc comments (#6612)
Part of https://github.com/oxc-project/backlog/issues/130
2024-10-15 22:50:47 +00:00
overlookmotel
7cc05f1626 fix(data_structures): fix compilation failure on older Rust versions (#6526)
I thought I was being clever, but too clever = stupid.

The dummy code designed to flag when our MSRV is bumped and supports `NonNull::add` would fail to compile on Rust versions below 1.80.0. Precisely because of the condition this code is testing - it's not supported!

Fix this by skipping compilation unless running clippy.
2024-10-13 17:32:10 +00:00
overlookmotel
cc57541281 refactor(data_structures): NonEmptyStack::len hint that len is never 0 (#6220)
Tiny optimization. Make sure compiler knows that `NonEmptyStack::len` can never return 0.
2024-10-01 14:58:36 +00:00
overlookmotel
147a5d50fd refactor(data_structures): remove is_empty methods for non-empty stacks (#6219)
Remove `SparseStack::is_empty` method. It's pointless as the stack is never empty.

Add a dummy `NonEmptyStack::is_empty` method that always returns `false`. This is also pointless, but it overrides `slice::is_empty` which is otherwise accessible via `Deref`.
2024-10-01 14:58:35 +00:00
overlookmotel
61805fd3f2 refactor(data_structures): add debug assertion to SparseStack (#6218)
Just add an additional debug assert.
2024-10-01 12:26:38 +00:00
overlookmotel
7566c2d66f feat(data_structures): add as_slice + as_mut_slice methods to stacks (#6216)
Add `as_slice` and `as_mut_slice` methods to `Stack` and `NonEmptyStack`.
2024-10-01 12:26:36 +00:00
overlookmotel
dbfa0bc01f refactor(data_structures): add len method to StackCommon trait (#6215)
`len` method is in common between all stack types. Move it into `StackCommon` trait.
2024-10-01 12:26:35 +00:00
Boshen
c3c3447ac3 feat(data_structures): add oxc_data_structures crate; add stack (#6206) 2024-10-01 10:02:45 +00:00