Repository navigation
fix: resolve needless_late_init lints flagged by newer clippy - #16
Merged
Merged
Conversation
- Add CI workflow running rustfmt, clippy (-D warnings), tests, doctests and an MSRV check. - Cargo.toml: add rust-version (1.85), categories, package excludes, and a [lints] table that allows clippy lints inherent to a faithful SOFA port (long argument lists, full-precision literals, index loops, SOFA-style doc layout, NaN-sensitive range checks). - Fix doctests: mark SOFA text tables/formulas in doc comments as `text` blocks so rustdoc no longer compiles them (291 failing -> 0). - Fix clippy errors/warnings: use std PI/TAU for DPI/D2PI (same f64 values), apply safe auto-fixes, rename private CamelCase structs, keep max/min in refco to preserve SOFA NaN handling. - Run cargo fmt over the whole crate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4qZWR3v6eu28sGykfJCtY
CI runs the latest stable toolchain (1.99), whose clippy reports needless_late_init in refco, jdcalf and moon98. Bind the values directly from the if/match expressions instead of declaring them first. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y4qZWR3v6eu28sGykfJCtY
…ardization-7ymogg' into claude/rust-project-config-standardization-7ymogg # Conflicts: # src/astro/refco.rs
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.
Summary
The Clippy job in CI fails on
main(run https://github.com/astro-xao/sofars/actions/runs/40114912999). CI installs the latest stable toolchain (Rust 1.99), whose clippy reportsneedless_late_initin five places. With-D warningsthese are errors:src/astro/refco.rs—pw,gammasrc/cal/jdcalf.rs—j,denomsrc/eph/moon98.rs—en,den(longitude and latitude loops)Each one now binds its value directly from the
if/matchexpression instead of declaring the variable first and assigning it in each branch. The logic is unchanged.Testing
On Rust 1.99 (the version CI uses):
cargo fmt --check✅cargo clippy --all-targets -- -D warnings✅cargo test✅ (all test suites and doctests pass)cargo +1.85 check --lib✅Generated by Claude Code