refactor: improve type safety and API clarity#3074
Merged
Conversation
messense
commented
Mar 9, 2026
Member
- source_distribution/unpack.rs: Replace bare (TempDir, PathBuf, PathBuf) tuple with named UnpackedSdist struct for self-documenting fields
- target/mod.rs: Change get_supported_architectures() to return &'static [Arch] instead of allocating Vec on every call
- source_distribution/unpack.rs: Replace bare (TempDir, PathBuf, PathBuf) tuple with named UnpackedSdist struct for self-documenting fields - target/mod.rs: Change get_supported_architectures() to return &'static [Arch] instead of allocating Vec<Arch> on every call
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors sdist unpacking to use a named return type for clearer APIs and updates architecture support lookup to avoid per-call allocations.
Changes:
- Introduces
UnpackedSdistto replace the(TempDir, PathBuf, PathBuf)tuple return fromunpack_sdist(). - Updates call sites (tests + build flow) to destructure
UnpackedSdist. - Updates
get_supported_architectures()to return&'static [Arch]instead of allocatingVec<Arch>each call.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/run/sdist.rs | Updates tests to destructure the new UnpackedSdist return type. |
| tests/common/other.rs | Updates shared test helper to destructure UnpackedSdist. |
| src/target/mod.rs | Returns static slices for supported architectures (no allocations). |
| src/source_distribution/unpack.rs | Adds UnpackedSdist struct and returns it from unpack_sdist(). |
| src/source_distribution/mod.rs | Re-exports UnpackedSdist from the module. |
| src/metadata.rs | Replaces vec![]/Default::default() with explicit constructors (no semantic change). |
| src/main.rs | Adapts wheel-from-sdist build flow to new unpack API; renames local struct. |
| src/lib.rs | Re-exports UnpackedSdist from the crate root API. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.