Skip to content

Cleanup: low-risk simplifications + image/gzip docs + v0.2.0#3

Merged
ssmichael1 merged 4 commits into
mainfrom
feature/cleanup-and-docs
Jun 1, 2026
Merged

Cleanup: low-risk simplifications + image/gzip docs + v0.2.0#3
ssmichael1 merged 4 commits into
mainfrom
feature/cleanup-and-docs

Conversation

@ssmichael1
Copy link
Copy Markdown
Owner

Combines the approved code-simplification pass with the image/gzip documentation and a version bump. No behavior change — all tests (incl. the funpack/astropy bit-exact suites) pass; default build stays zero-dependency; clippy clean on --all-features --all-targets -D warnings.

Simplifications (behavior-preserving)

  • keyword.rs: collapse format_float; strip_suffix('&'); extract logical_str / fortran_exp (reused in ascii_table.rs).
  • header.rs: single END-card check; cards.resize() for padding.
  • checksum.rs: extract fold_carries (was written 3×).
  • hdu.rs: extract data_bytes (duplicated in write_impl/verify_datasum).
  • tile_compress.rs: generic gather_tile<T> (drops duplicate gather_tile_f64); tile_dims_at delegates to the free fn; iseed advance via % N_RANDOM.
  • image_conv.rs: extract luma16_to_image shared by the Luma16/other arms.

Intentionally skipped: the bintable.rs big-endian decode consolidation — too risky to refactor published bit-exact decode for a modest LOC gain. Also held (separate careful pass): the DitherRng extraction and the keyword comment-column refactor.

Docs

  • image-crate interop example (to_dynamic_image / from_dynamic_image) and a gzip-feature note in both README and lib.rs. The lib.rs image doctest is #[cfg(feature = "image")] + no_run, so default and --all-features doctests both pass.

Version

  • 0.1.00.2.0 (additive features since the 0.1.0 publish: encode path, PLIO/HCOMPRESS/float decode, WCS).

Net: −21 LOC (≈ −70 code, + new docs examples).

ssmichael1 and others added 4 commits May 31, 2026 21:10
Low-risk reductions identified by analysis; no behavior change (all tests,
including the funpack/astropy bit-exact suites, still pass):

- keyword.rs: collapse format_float; strip_suffix('&') for continuation;
  extract logical_str() and fortran_exp() helpers (reused in ascii_table.rs).
- header.rs: single END-card check; cards.resize() for padding.
- checksum.rs: extract fold_carries() (end-around carry, was written 3x).
- hdu.rs: extract data_bytes() (was duplicated in write_impl/verify_datasum).
- tile_compress.rs: make gather_tile generic <T: Copy> and drop the duplicate
  gather_tile_f64; tile_dims_at method delegates to the free fn; iseed advance
  uses % N_RANDOM.
- image_conv.rs: extract luma16_to_image() shared by the Luma16/other arms.

(The bintable big-endian decode consolidation was intentionally skipped — too
risky to refactor published bit-exact decode for a modest LOC gain.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- README + lib.rs: add an `image`-crate interop example (to_dynamic_image /
  from_dynamic_image) and a `gzip`-feature note; the lib.rs image doctest is
  cfg-gated + no_run so default and --all-features doctests both pass.
- Cargo.toml: version 0.1.0 -> 0.2.0 (additive features since 0.1.0: encode
  path, PLIO/HCOMPRESS/float decode, WCS).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ssmichael1 ssmichael1 merged commit e4bb328 into main Jun 1, 2026
1 check passed
@ssmichael1 ssmichael1 deleted the feature/cleanup-and-docs branch June 1, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant