Skip to content

Fix clippy::needless_range_loop in picker_state test (rustc 1.100.0) - #54

Merged
muhac merged 1 commit into
mainfrom
cursor/fix-clippy-needless-range-loop-13f7
Nov 16, 2026
Merged

muhac merged 1 commit into
mainfrom
cursor/fix-clippy-needless-range-loop-13f7

Conversation

@muhac

@muhac muhac commented Nov 16, 2026

Copy link
Copy Markdown
Owner

CI's stable toolchain moved to rustc 1.100.0, whose Clippy flags needless_range_loop in the fresh_state_has_no_selection_and_top_level_expanded test in src/picker_state.rs. This fails the cargo clippy --all-targets -- -D warnings step on all three platforms (see #53).

Changes:

  • Iterate over &s.selected directly instead of indexing with 0..s.nodes.len().
  • Add assert_eq!(s.selected.len(), s.nodes.len()) so the check still covers every node (selected is built as vec![false; n]). Behavior is unchanged.

Verified locally with rustc 1.100.0 stable: cargo clippy --all-targets -- -D warnings is clean, cargo fmt --check passes and cargo test --all-targets passes. No #[allow] added.

Open in Web Open in Cursor 

Co-authored-by: Muhan Li <limuhan@msn.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T17:52:03.706865Z 84f9fb1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automation review — clean

Reviewed the only change in fresh_state_has_no_selection_and_top_level_expanded: replacing the indexed range loop with direct iteration over s.selected, plus assert_eq!(s.selected.len(), s.nodes.len()).

PickerState::from_tree always initializes selected as vec![false; nodes.len()], so behavior is unchanged and the length assertion actually strengthens the test (it would catch a future invariant break that the old 0..s.nodes.len() loop could miss if selected were ever shorter). No correctness, security, or regression concerns in this diff.

Open in Web View Automation 

Sent by Cursor Automation: Review PR changes

@muhac
muhac merged commit d5ca013 into main Nov 16, 2026
7 checks passed
@muhac
muhac deleted the cursor/fix-clippy-needless-range-loop-13f7 branch November 16, 2026 17:55
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.

2 participants