refactor(lexer): Token::read_bool use NonNull pointer#21660
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
There was a problem hiding this comment.
Pull request overview
Refactors Token::read_bool in the parser lexer to use std::ptr::NonNull instead of raw pointers, aligning it with the existing NonNull-based pointer access patterns in this file and slightly simplifying the unsafe read path.
Changes:
- Replaced
ptr::from_ref(self)+ raw pointer usage inToken::read_boolwithNonNull::from_ref(self)andNonNullAPIs. - Simplified the
boolread by removing theunwrap_unchecked()path (sinceNonNull::as_ref()is infallible). - Removed the now-unused
std::ptrimport.
Merging this PR will not alter performance
Comparing Footnotes
|
f1248de to
f7a428f
Compare
d3fd6bc to
605a60b
Compare
605a60b to
c143e49
Compare
f7a428f to
2290f31
Compare
c143e49 to
81dab06
Compare
Merge activity
|
Small refactor. `NonNull` is more ergonomic and in some cases can be more performant than raw pointers (avoids non-null check).
81dab06 to
0aa13eb
Compare

Small refactor.
NonNullis more ergonomic and in some cases can be more performant than raw pointers (avoids non-null check).