Repository navigation
fix(lint): satisfy Clippy from Rust 1.100 - #905
Conversation
The CI runners moved from Rust 1.99.1 to 1.100.0, whose Clippy rejects two existing sites under -D warnings: an indexed range loop in the tagged simplifier (needless_range_loop) and, where the cfg(unix) block compiles away, an early-return bool in the GeoPackage image metadata comparison (needless_bool). Neither change alters behavior.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewThis PR is a small, behavior-preserving Clippy fix in two files. I found no bugs and no security issues. I confirmed the two refactors keep their semantics, and I posted one nit inline. Bugs: None found.
Security: None found. Performance: None found. Both changes are constant-time per iteration and do no extra work. Quality:
CLAUDE.md (AGENTS.md):
Unverified: The Change sizeCompared with base: the whole PR against main (merge base d88099d to PR head dfebeba).
|
- simplify: iterate the slice points[owner][a + 1..b] instead of enumerate().take(b).skip(a + 1), so an out-of-range bound still panics as the indexed loop did rather than truncating silently.
|
|
||
| /// Platforms without inode metadata compare the length and modification time only. | ||
| #[cfg(all(feature = "sqlite", not(unix)))] | ||
| fn same_inode(_before: &std::fs::Metadata, _after: &std::fs::Metadata) -> bool { |
There was a problem hiding this comment.
Nit (naming, confidence: medium): on non-Unix this same_inode never inspects inodes and just returns true, so the name claims a check that does not happen. The doc comment explains it, but a name such as inode_unchanged (or status_unchanged) would read correctly on both branches. The rename touches the Unix variant and its call site in same_image_metadata, so I have not included a suggestion block. The behavior is unchanged either way, and the non-Unix result matches the pre-PR code.
There was a problem hiding this comment.
Left as is: the PR merged before this round, and the name states the question the helper answers (is this still the same inode), with the doc comment covering the platforms that cannot ask it. Behavior matches the code before the PR on every platform, so I am not opening a follow-up for the rename alone.
Code reviewBugs: None found. I checked both changes for behavioral equivalence.
Security: None found. The change is a pure refactor with no new input handling. Performance: None. The iterator form does one bounds check on the slice instead of one per index. The effect is negligible. Quality:
CLAUDE.md / AGENTS.md:
Not verified here: The Change sizeCompared with the base branch: the whole PR against
|
Fixes the red CI on main: the workspace builds cleanly under Clippy from Rust 1.100 again. No user-visible behavior changes.
Cause
The GitHub runners' stable toolchain moved from Rust 1.99.1 to 1.100.0 between the runs on
52ab8f36(green, 1.99.1) and401165f0/d88099da(red, 1.100.0). Clippy 1.100 flags two sites that have been in the tree since October, and CI runs Clippy with-D warnings, soterriono longer compiles in the lint step:crates/terrio/src/ops/simplify.rs:221,needless_range_loop:for k in a + 1..bindexingself.points[owner][k]. Failsubuntu-latest,macos-latest,windows-latestandGDAL backend (feature build).crates/terrio/src/gpkg_validate.rs:6,needless_bool: on Windows the#[cfg(unix)]block compiles away, leavingif … { return false; } true. Failswindows-latestonly.No commit on main caused this; both files were last touched in #406.
Fix
enumerate().take(b).skip(a + 1), visiting the same indices in the same order, so the farthest-point choice and its tie-breaking are unchanged.same_image_metadatais one boolean expression that calls asame_inodehelper: the device, inode and ctime comparison on Unix, andtrueelsewhere. The result is the same on every platform as before.Evidence
cargo clippy --workspace --all-targets -- -D warningsfailed on thesimplify.rssite before the change and finishes cleanly after it.cargo fmt --all -- --check, thendarrayClippy invocation and bothterrio-crsClippy invocations fromci.yml.cargo test -p terrio --lib -- simplify gpkg_validate: 19 passed, 1 ignored.needless_boolsite only exists on non-Unix targets, and the--features gdalClippy invocations did not build in my local environment (agdal-sysbuild-script failure unrelated to this change). Labeledci:allso the Windows, macOS and GDAL backend jobs that failed on main prove both here.Summary by CodeRabbit