GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add more pedantic clippy rules by ShaharNaveh · Pull Request #7830 · RustPython/RustPython

Conversation

@ShaharNaveh

@ShaharNaveh ShaharNaveh commented May 11, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Refactor

    • Unified iteration/borrowing patterns across compiler, VM, stdlib and codegen to improve consistency while preserving behavior.
  • Chores

    • Enabled additional Clippy lints (set to "warn") to strengthen code-quality checks and enforce more consistent coding patterns.

Review Change Stack

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ShaharNaveh added 4 commits May 11, 2026 09:58
@ShaharNaveh
Add some rules
c272f64
@ShaharNaveh
Add explicit_iter* clippy rules
113fc7e
@ShaharNaveh
Fix clippy rules
749e815
@ShaharNaveh
Add more clippy rules
317ea17
@coderabbitai

coderabbitai Bot commented May 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: f2748a38-31a7-4500-918b-e7b3a0d07d65

📥 Commits

Reviewing files that changed from the base of the PR and between 0d5bf96 and d09a5ae.

📒 Files selected for processing (10)
  • Cargo.toml
  • crates/codegen/src/compile.rs
  • crates/codegen/src/ir.rs
  • crates/stdlib/src/faulthandler.rs
  • crates/vm/src/builtins/template.rs
  • crates/vm/src/builtins/type.rs
  • crates/vm/src/frame.rs
  • crates/vm/src/stdlib/_ctypes/base.rs
  • crates/vm/src/stdlib/_io.rs
  • crates/vm/src/stdlib/_typing.rs
✅ Files skipped from review due to trivial changes (8)
  • crates/vm/src/builtins/template.rs
  • crates/vm/src/stdlib/_typing.rs
  • crates/vm/src/stdlib/_ctypes/base.rs
  • crates/vm/src/frame.rs
  • crates/vm/src/stdlib/_io.rs
  • crates/stdlib/src/faulthandler.rs
  • crates/vm/src/builtins/type.rs
  • crates/codegen/src/ir.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • Cargo.toml
  • crates/codegen/src/compile.rs

📝 Walkthrough

Walkthrough

Enable new workspace Clippy lints in Cargo.toml, then replace explicit iterator method calls across the codebase with direct or borrowed for-loop iteration (for x in &collection / for x in collection).

Changes

Clippy Iterator Pattern Compliance

Layer / File(s) Summary
Lint Configuration
Cargo.toml
Workspace Clippy configuration now enables collapsible_else_if, comparison_chain, explicit_into_iter_loop, explicit_iter_loop, filter_map_next, flat_map_option, and inconsistent_struct_constructor at "warn".
Codegen compilation loops
crates/codegen/src/compile.rs
Local loops over elts and tstring_value changed to iterate directly (for ... in ...) instead of .iter().
IR passes & stack-depth fixups
crates/codegen/src/ir.rs
finalize_code and max_stackdepth loops switched to for block in &mut blocks / for block in &mut self.blocks.
Compiler-core loops
crates/compiler-core/src/bytecode.rs, crates/compiler-core/src/marshal.rs
Adaptive counters and code serialization loops now iterate by reference (&self.adaptive_counters, &code.varnames, &code.freevars).
Stdlib: faulthandler & ssl
crates/stdlib/src/faulthandler.rs, crates/stdlib/src/ssl/cert.rs
FAULTHANDLER_HANDLERS and CRL/CA certificate loops updated to borrowed iteration forms.
Stdlib: marshal, atexit, gc, nt, I/O
crates/vm/src/stdlib/*, crates/stdlib/src/faulthandler.rs
PyDict, Vec/env, atexit callbacks, gc stats, and I/O __setstate__ loops changed from consuming iterators to non-consuming or borrowed iteration.
VM builtins & core runtime
crates/vm/src/builtins/*, crates/vm/src/frame.rs, crates/vm/src/gc_state.rs, crates/vm/src/object/core.rs
Namespace initializer, Template.__new__, MRO traversal, SLOT_DEFS loop, exception-group tuple handling, cellvar syncing, GC finalization, slot clearing, and typing tuple formatting use borrowed/direct iteration.
ctypes: fields, init, structure/union
crates/vm/src/stdlib/_ctypes*.rs
Field traversal, anonymous-field promotion, structure/union size calc, and initializer kwargs/args traversal switched to for ... in &... patterns.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • RustPython/RustPython#7764: Workspace Clippy lint configuration updates.
  • RustPython/RustPython#7631: Related edits touching crates/vm/src/frame.rs.
  • RustPython/RustPython#7755: Workspace Clippy lint changes and iterator-style refactors.

Suggested reviewers

  • youknowone
  • coolreader18

Poem

🐇 I hopped through loops with steady paw,

Replaced .iter() with borrows, hurrah!
No ownership tug, no move to dread,
Clippy nods while I munch my bread.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: enabling additional Clippy lint rules in Cargo.toml, with all subsequent code changes being automated refactorings to comply with these new rules.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ShaharNaveh added 2 commits May 11, 2026 10:33
@ShaharNaveh
Fix windows clippy
2cd6b76
@ShaharNaveh
clippy windows
0d5bf96
youknowone
youknowone approved these changes May 11, 2026
View reviewed changes
youknowone
youknowone approved these changes May 11, 2026
View reviewed changes
@ShaharNaveh
Merge remote-tracking branch 'upstream/main' into clippy-collapsible-…
d09a5ae
…else-if
@youknowone
youknowone merged commit 9d77b25 into RustPython:main May 12, 2026
25 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request May 15, 2026
Clippy nursery lints #7875
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Jun 6, 2026
more clippy rules #8050
Merged
2 tasks
This was referenced Jun 16, 2026
Clippy ref_option #8122
Merged
More clippy rules #8123
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Jun 28, 2026
Add more clippy rules #8183
Merged
2 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Aug 6, 2026
Fix a few WASI lints #8457
Merged
1 of 2 tasks
youknowone pushed a commit that referenced this pull request Sep 16, 2026
@ShaharNaveh
Add more pedantic clippy rules (#7830)
7b2379d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ShaharNaveh @youknowone
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.