refactor: split zig.rs into smaller modules - #470
Merged
Conversation
Convert the 3000-line src/zig.rs into a src/zig/ directory split by concern, as a pure move with no behavior changes: - mod.rs: the Zig clap subcommand and its execution entry points (zig cc/ar/dlltool dispatch), plus re-exports keeping every public path (zig::Zig, zig::ZigWrapper, zig::prepare_zig_linker, zig::adjust_canonicalization) unchanged for library consumers - target_info.rs: TargetInfo and its target-triple predicates - linker_args.rs: linker argument filtering and CPU/feature name mapping, with the whole test_filter_* suite alongside - locate.rs: finding and validating the zig toolchain (find_zig, zig_version, lib_dir, cache_dir) - cargo_env.rs: cargo build environment setup (apply_command_env, bindgen options, OS deps, cmake toolchain) - wrapper.rs: linker wrapper script generation (prepare_zig_linker, TargetFlags, script quoting helpers) Helpers that now cross file boundaries became pub(crate); nothing new is pub. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tmb8F6fH8SvQ6KarnaJuxR
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.
What
Converts the 3000-line
src/zig.rsinto asrc/zig/directory split by concern. This is a pure move refactor — no behavior changes.mod.rsZigclap subcommand + execution entry points (zig cc/ar/dlltooldispatch), re-exportstarget_info.rsTargetInfoand its target-triple predicateslinker_args.rstest_filter_*suite alongsidelocate.rsfind_zig,zig_version,lib_dir,cache_dir)cargo_env.rsapply_command_env, bindgen options, OS deps, cmake toolchain)wrapper.rsprepare_zig_linker,TargetFlags, script quoting)Compatibility
Public API is unchanged:
zig::Zig,zig::ZigWrapper,zig::prepare_zig_linker, andzig::adjust_canonicalizationresolve to the same paths via re-exports inmod.rs, so library consumers (e.g. maturin) are unaffected. Helpers that now cross file boundaries becamepub(crate); nothing new ispub.Verification
cargo build— cleancargo test— 37 passed, 0 failed (all filter/wrapper tests moved with their modules)cargo clippy --all-targets --all-features— only pre-existing warnings (in code copied verbatim)cargo fmt --all— no reformatting needed🤖 Generated with Claude Code
https://claude.ai/code/session_01Tmb8F6fH8SvQ6KarnaJuxR