Skip to content

refactor(allocator): fix lifetimes clippy warnings#21210

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-08-refactor_allocator_fix_lifetimes_clippy_warnings
Apr 9, 2026
Merged

refactor(allocator): fix lifetimes clippy warnings#21210
graphite-app[bot] merged 1 commit intomainfrom
om/04-08-refactor_allocator_fix_lifetimes_clippy_warnings

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 9, 2026

bump.rs was copied directly from bumpalo. bumpalo supports much older Rust versions than Oxc does, so uses patterns which are flagged by Clippy in more recent versions. #20963 silenced these clippy errors/warnings with a large #[expect] block at the top of the file.

This stack of PRs fixes these warnings and removes the #[expect(clippy:...)] comments. All PRs in this stack were generated by Claude. I had him split them into 1 PR per clippy rule so that I could review each in isolation - some of the changes, especially around pointers, are quite subtlle.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 9, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 9, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/04-08-refactor_allocator_fix_lifetimes_clippy_warnings (1c9245a) with main (f21d3aa)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@overlookmotel overlookmotel marked this pull request as ready for review April 9, 2026 07:49
Copilot AI review requested due to automatic review settings April 9, 2026 07:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the allocator refactor by addressing Clippy’s elidable_lifetime_names / needless_lifetimes warnings in oxc_allocator’s bump.rs, allowing the corresponding #![expect(clippy::...)] entries to be removed.

Changes:

  • Removed clippy::elidable_lifetime_names and clippy::needless_lifetimes from the file-level #![expect(...)] list.
  • Updated trait impl headers to use elided/anonymous lifetimes where appropriate (ChunkIter’s FusedIterator, and Alloc/Allocator impls for &Bump).

@overlookmotel overlookmotel self-assigned this Apr 9, 2026
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Apr 9, 2026

Merge activity

`bump.rs` was copied directly from `bumpalo`. `bumpalo` supports much older Rust versions than Oxc does, so uses patterns which are flagged by Clippy in more recent versions. #20963 silenced these clippy errors/warnings with a large `#[expect]` block at the top of the file.

This stack of PRs fixes these warnings and removes the `#[expect(clippy:...)]` comments. All PRs in this stack were generated by Claude.  I had him split them into 1 PR per clippy rule so that I could review each in isolation - some of the changes, especially around pointers, are quite subtlle.
@graphite-app graphite-app bot force-pushed the om/04-08-refactor_allocator_fix_lifetimes_clippy_warnings branch from 85644c8 to 1c9245a Compare April 9, 2026 08:45
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
Continuation of #21210.

Use `NonNull::from_ref` to construct self-pointing pointers in `EMPTY_CHUNK`. This removes some `unsafe` code.
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
Continuation of #21210.

Replace `x as *const T` /  `x as *mut T` with `ptr::from_ref(x)` / `ptr::from_mut(x)`. Note that this change does not materialize any references which did not already exist in original code.
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
Continuation of #21210.

Replace `ptr as *const u8` / `ptr as *mut u8` with `ptr.cast::<u8>()`. The constness of pointers is not altered by this change.
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
Continuation of #21210.

Replace `ptr as *const T` / `ptr as *mut T` with `ptr.cast_const()` / `ptr.cast_mut()`. This reveals one dodgy `const` to `mut` conversion in `ChunkRawIter`, which I'll address in a later PR.
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
Continuation of #21210.

Move an `#[expect(clippy::cast_ptr_alignment)]`attribute from blanket exclusion to a focused one at the location where this rule needs to be disabled, and add the reason why it's safe to ignore.
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
Continuation of #21210.

Move an `#[expect(clippy::cast_sign_loss)]`attribute from blanket exclusion to a focused one at the location where this rule needs to be disabled, and add the reason why it's safe to ignore.
@graphite-app graphite-app bot merged commit 1c9245a into main Apr 9, 2026
36 checks passed
@graphite-app graphite-app bot deleted the om/04-08-refactor_allocator_fix_lifetimes_clippy_warnings branch April 9, 2026 08:55
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
Continuation of #21210.

Remove `#[expect(clippy::mut_from_ref)]`attribute from top level, and add it on all methods which take an immutable `&self` and return a `&mut` reference. This usually-unsound pattern is sound here as `Bump` uses interior mutability.
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
graphite-app bot pushed a commit that referenced this pull request Apr 9, 2026
…21231)

Same as stack starting at #21210.

`bumpalo_alloc.rs` was copied directly from `bumpalo`. `bumpalo` supports much older Rust versions than Oxc does, so uses patterns which are flagged by Clippy in more recent versions. #20963 silenced these clippy errors/warnings with a large `#[expect]` block at the top of the file.

This stack of PRs fixes these warnings and removes the `#[expect(clippy:...)]` comments. All PRs in this stack were generated by Claude.  I had him split them into 1 PR per clippy rule so that I could review each in isolation - some of the changes, especially around pointers, are quite subtlle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocator Area - Allocator C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants