Skip to content

fix(xyz): allow unused mut on non-Unix builds - #316

Merged
giswqs merged 1 commit into
mainfrom
fix/xyz-windows-unused-mut
Oct 27, 2026
Merged

giswqs merged 1 commit into
mainfrom
fix/xyz-windows-unused-mut

Conversation

@giswqs

@giswqs giswqs commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Fixes the Windows Clippy failure on main (https://github.com/opengeos/terrio/actions/runs/40441232999/job/121981828434) introduced by #303: write_xyz_file binds let mut builder = tempfile::Builder::new() but only mutates it inside the #[cfg(unix)] permissions block, so -D warnings rejects the unused mut on Windows.

The fix adds #[cfg_attr(not(unix), allow(unused_mut))] to the binding, the same pattern crates/terrio/src/info.rs uses for feature-gated mutation. No behavior change.

Validation: cargo fmt --all -- --check and cargo clippy -p terrio --all-targets -- -D warnings pass on Linux. A local Windows cross-check isn't possible here (no mingw C toolchain), so this PR carries the ci:windows label to run the Windows job.

Summary by CodeRabbit

  • Chores
    • Adjusted a platform-specific compiler warning in XYZ file writing. This is an internal maintenance change and does not alter user-visible behavior.

The tempfile builder is only mutated in the #[cfg(unix)] permissions
block, so Windows Clippy rejected the binding with -D unused-mut and
broke the macOS and Windows CI on main.
@giswqs giswqs added the ci:windows Run CI on Windows for this pull request label Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 01faa3d5-c22b-4632-9b9c-bf9d1dc5a667
Commits

Reviewing files that changed from the base of the PR and between 67d87c2 and d8da151.

Files selected for processing: 1
  • crates/terrio/src/ops/xyz.rs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

write_xyz_file now applies allow(unused_mut) to its mutable temporary-file builder binding on non-Unix platforms. The binding remains mutable on all platforms.

Changes: XYZ file writing

Layer / File(s) Summary
Conditional lint attribute
crates/terrio/src/ops/xyz.rs
The temporary-file builder binding allows unused_mut on non-Unix platforms. Its mutability is unchanged.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Bug fix

Possibly related PRs

  • opengeos/terrio#303: Adds write_xyz_file and its Unix-only permission mutation, which the changed binding belongs to.
Merge Risk: Minimal · up to d8da1

The lint-only adjustment is mergeable with no identified behavior or availability impact.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the change: allowing unused mutability on non-Unix builds for the XYZ functionality.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the builder’s name,
On non-Unix, the lint stays tame.
The binding keeps its mutable state,
While warnings wait outside the gate.
One quiet line completes the frame.

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs: None found. The change is a single attribute, #[cfg_attr(not(unix), allow(unused_mut))], on the let mut builder = tempfile::Builder::new(); binding in write_xyz_file (crates/terrio/src/ops/xyz.rs:241). builder is only mutated inside the #[cfg(unix)] block, so the lint would fire on Windows without it. The attribute is valid on a let statement. The whole function is already gated #[cfg(not(target_family = "wasm"))], so the attribute is never compiled into the wasm build. Behaviour on Unix is unchanged. (Confidence: high.)

Security: None found. No input handling or I/O behaviour changes. (Confidence: high.)

Performance: None found. (Confidence: high.)

Quality: Nothing material. The attribute matches the feature-gated pattern already used at crates/terrio/src/info.rs:429, so it is consistent with the codebase. An alternative would be to move the let into the #[cfg(unix)] block, but the current form is simpler and follows the existing precedent. (Confidence: high.)

CLAUDE.md / AGENTS.md: The change is consistent with the repository instructions: a regression-free lint fix, with no shared-algorithm or binding changes. The PR body says cargo fmt and cargo clippy -p terrio --all-targets -- -D warnings pass on Linux. The Windows Clippy result can only be confirmed by the ci:windows job, which the PR requests. I could not verify it here. (Confidence: high.)

No inline comments posted; there is nothing in the changed lines that needs a suggestion.

Change size

Compared with the base branch: the whole PR against main (merge base 67d87c2 to PR head d8da151).

Metric Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 18.7 KB
Size after 18.8 KB
Total size change +46 B
Path Size before Size after Size change
crates/terrio/src/ops/xyz.rs 18.7 KB 18.8 KB +46 B

@giswqs
giswqs merged commit 335a410 into main Oct 27, 2026
22 of 24 checks passed
@giswqs
giswqs deleted the fix/xyz-windows-unused-mut branch October 27, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:windows Run CI on Windows for this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant