-
Notifications
You must be signed in to change notification settings - Fork 5.1k
sourcemap: make ParseResult a Result alias (fixes clippy on main) #38272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 This doc-comment update from
ParseResult::Fail→ParseResultFailmissed three sibling references:src/jsc/bindings/highway_sourcemap.cpp:918andtest/js/node/module/sourcemap-simd.test.ts:447,462still sayParseResult::Fail. Comment-only, no behavior impact — but per REVIEW.md "grep for every sibling site sharing the pattern", these should be updated in the same PR.Extended reasoning...
What the bug is
This PR replaces
enum ParseResult { Fail(ParseResultFail), Success(ParsedSourceMap) }withpub type ParseResult = Result<ParsedSourceMap, ParseResultFail>, so theParseResult::Failvariant no longer exists. The PR correctly updated the doc comment atsrc/sourcemap/error.rs:40fromParseResult::FailtoParseResultFailto reflect this, but missed three other comments in the repo that still reference the deleted variant.The specific stale sites
A repo-wide grep for
ParseResult::Failafter this PR shows:src/jsc/bindings/highway_sourcemap.cpp:918—// and reports the exact same ParseResult::Fail as before.test/js/node/module/sourcemap-simd.test.ts:447—// Scalar caps at 8 bytes and returns no-progress -> ParseResult::Fail;test/js/node/module/sourcemap-simd.test.ts:462—test("out-of-range source index: identical ParseResult::Fail", ...)These are the only remaining hits; the PR updated all Rust match arms and the
error.rsdoc comment but did not sweep C++ comments or test descriptions.Why existing checks don't catch this
These are all inside comments (or a test title string), so neither
rustc,clang, norclippysees them. The PR's stated verification (bun run rust:clippy+ runtime smoke tests) exercises none of them.Why this is worth fixing
REVIEW.md, under Correctness: the bug class, not the bug → "Fix the whole class in the same PR — grep for every sibling site sharing the pattern" and "Signature changes and renames → grep the whole repo". The PR explicitly recognized this class by editing
error.rs:40, so the three remaining sites are same-class stragglers. Left as-is, a future reader grepping forParseResult::Fail(from these comments) will find no such symbol.Step-by-step proof
ParseResult::Failis a real enum variant (src/sourcemap/lib.rs:108in the base).-pub enum ParseResult { Fail(...), Success(...) }/+pub type ParseResult = Result<...>.error.rs:40ParseResult::Fail→ParseResultFail.rg 'ParseResult::Fail'on the post-PR tree still returns 3 hits (listed above) — none of them in Rust, so they were missed by the mechanicalFail(→Err(/Success(→Ok(sweep.How to fix
Update the three comments to say
ParseResultFail(orErr(ParseResultFail)where the phrasing describes the return value), matching the change already made aterror.rs:40. Zero behavior impact.